mirror-linux/arch/um/drivers
Linus Torvalds 1a251f52cf minmax: make generic MIN() and MAX() macros available everywhere
This just standardizes the use of MIN() and MAX() macros, with the very
traditional semantics.  The goal is to use these for C constant
expressions and for top-level / static initializers, and so be able to
simplify the min()/max() macros.

These macro names were used by various kernel code - they are very
traditional, after all - and all such users have been fixed up, with a
few different approaches:

 - trivial duplicated macro definitions have been removed

   Note that 'trivial' here means that it's obviously kernel code that
   already included all the major kernel headers, and thus gets the new
   generic MIN/MAX macros automatically.

 - non-trivial duplicated macro definitions are guarded with #ifndef

   This is the "yes, they define their own versions, but no, the include
   situation is not entirely obvious, and maybe they don't get the
   generic version automatically" case.

 - strange use case #1

   A couple of drivers decided that the way they want to describe their
   versioning is with

	#define MAJ 1
	#define MIN 2
	#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN)

   which adds zero value and I just did my Alexander the Great
   impersonation, and rewrote that pointless Gordian knot as

	#define DRV_VERSION "1.2"

   instead.

 - strange use case #2

   A couple of drivers thought that it's a good idea to have a random
   'MIN' or 'MAX' define for a value or index into a table, rather than
   the traditional macro that takes arguments.

   These values were re-written as C enum's instead. The new
   function-line macros only expand when followed by an open
   parenthesis, and thus don't clash with enum use.

Happily, there weren't really all that many of these cases, and a lot of
users already had the pattern of using '#ifndef' guarding (or in one
case just using '#undef MIN') before defining their own private version
that does the same thing. I left such cases alone.

Cc: David Laight <David.Laight@aculab.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-07-28 15:49:18 -07:00
..
Kconfig um: Remove obsolete pcap driver 2024-07-03 12:19:25 +02:00
Makefile um: Remove obsolete pcap driver 2024-07-03 12:19:25 +02:00
chan.h um: chan: use blocking IO for console output for time-travel 2024-07-03 12:18:02 +02:00
chan_kern.c um: chan: use blocking IO for console output for time-travel 2024-07-03 12:18:02 +02:00
chan_user.c um: chan_user: retry partial writes 2024-07-03 12:18:02 +02:00
chan_user.h tty: um: convert to u8/__u8 and size_t 2023-12-08 12:02:38 +01:00
cow.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
cow_sys.h
cow_user.c
daemon.h
daemon_kern.c um: daemon: Make default socket configurable 2022-05-27 09:00:40 +02:00
daemon_user.c um: Some fixes to build UML with musl 2020-10-11 23:13:06 +02:00
fd.c
harddog.h um: harddog: fix modular build 2023-05-10 00:21:30 +02:00
harddog_kern.c um: harddog: add missing MODULE_DESCRIPTION() macro 2024-07-03 12:25:07 +02:00
harddog_user.c um: harddog: fix modular build 2023-05-10 00:21:30 +02:00
harddog_user_exp.c um: harddog: fix modular build 2023-05-10 00:21:30 +02:00
hostaudio_kern.c uml: audio: fix -Wmissing-variable-declarations 2023-08-26 22:43:42 +02:00
line.c um: line: always fill *error_out in setup_one_line() 2024-07-04 12:03:14 +02:00
line.h tty: um: convert to u8/__u8 and size_t 2023-12-08 12:02:38 +01:00
mconsole.h
mconsole_kern.c um: Refactor deprecated strncpy to memcpy 2023-08-26 22:48:38 +02:00
mconsole_kern.h
mconsole_user.c minmax: make generic MIN() and MAX() macros available everywhere 2024-07-28 15:49:18 -07:00
mmapper_kern.c um: mmaper: add __exit annotations to module exit funcs 2022-09-19 23:01:50 +02:00
net_kern.c um: Convert strscpy() usage to 2-argument style 2024-02-20 20:47:32 -08:00
net_user.c
null.c tty: um: convert to u8/__u8 and size_t 2023-12-08 12:02:38 +01:00
port.h
port_kern.c um: generalize os_rcv_fd 2024-07-03 12:24:25 +02:00
port_user.c um: port_user: Improve error handling when port-helper is not found 2022-03-11 10:55:55 +01:00
pty.c
random.c hwrng: core - treat default_quality as a maximum and default to 1024 2022-11-18 16:59:34 +08:00
rtc.h um: add a pseudo RTC 2021-02-12 21:38:52 +01:00
rtc_kern.c um: rtc: Convert to platform remove callback returning void 2024-04-30 14:18:49 +02:00
rtc_user.c isystem: trim/fixup stdarg.h and other headers 2021-08-19 09:02:55 +09:00
slip.h
slip_common.c
slip_common.h
slip_kern.c
slip_user.c um: fix error return code in slip_open() 2021-06-17 22:10:05 +02:00
slirp.h
slirp_kern.c um: fix 3 instances of -Wmissing-prototypes 2023-08-26 22:45:05 +02:00
slirp_user.c um: slirp: remove set but unused variable 'pid' 2024-04-22 22:26:41 +02:00
ssl.c um: Do not initialise statics to 0. 2022-09-19 23:10:07 +02:00
stderr_console.c
stdio_console.c um: Do not initialise statics to 0. 2022-09-19 23:10:07 +02:00
stdio_console.h
tty.c
ubd.h
ubd_kern.c This pull request contains the following changes for UML: 2024-07-25 12:33:08 -07:00
ubd_user.c um: Make local functions and variables static 2024-04-22 21:43:03 +02:00
umcast.h
umcast_kern.c
umcast_user.c
vde.h
vde_kern.c
vde_user.c
vector_kern.c um: vector: always reset vp->opened 2024-07-04 12:03:26 +02:00
vector_kern.h um: vector: remove vp->lock 2024-07-04 12:03:23 +02:00
vector_transports.c
vector_user.c um: Convert strscpy() usage to 2-argument style 2024-02-20 20:47:32 -08:00
vector_user.h uml: vector: Remove unused definitions VECTOR_{WRITE,HEADERS} 2023-02-13 10:14:32 +01:00
vhost_user.h um: virtio: Replace zero-length array with flexible-array 2020-06-02 22:38:00 +02:00
virt-pci.c Updates for the interrupt subsystem: 2024-07-22 13:52:05 -07:00
virtio_uml.c virtio: rename find_vqs_info() op to find_vqs() 2024-07-17 05:20:57 -04:00
xterm.c um: generalize os_rcv_fd 2024-07-03 12:24:25 +02:00
xterm.h
xterm_kern.c um: generalize os_rcv_fd 2024-07-03 12:24:25 +02:00