linux/drivers/staging
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
..
axis-fifo staging: axis-fifo: Fix indentation 2024-04-09 17:44:54 +02:00
fbtft staging: fbtft: add missing MODULE_DESCRIPTION() macro 2024-06-24 15:18:01 +02:00
fieldbus driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
gdm724x staging: gdm724x: constantify the struct device_type usage 2024-02-17 17:30:35 +01:00
greybus Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
iio staging: iio: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-06-13 19:19:23 +01:00
ks7010 staging: ks7010: replace open-coded module_sdio_driver() 2024-04-09 17:45:14 +02:00
media minmax: make generic MIN() and MAX() macros available everywhere 2024-07-28 15:49:18 -07:00
most
nvec staging: nvec: Use x instead of x != NULL to improve readability. 2024-07-03 16:15:26 +02:00
octeon Staging: octeon: Match parenthesis alignment 2024-03-05 14:03:15 +00:00
olpc_dcon staging: olpc_dcon: Remove I2C_CLASS_DDC support 2023-10-27 13:10:05 +02:00
rtl8192e staging: rtl8192e: Fix conflicting types error with net_device. 2024-06-27 15:45:16 +02:00
rtl8712 staging: r8712u: remove unused struct 'zero_bulkout_context' 2024-06-04 13:35:31 +02:00
rtl8723bs - In the series "treewide: Refactor heap related implementation", 2024-07-21 17:56:22 -07:00
rts5208 Staging driver changes for 6.10-rc1 2024-05-22 12:11:48 -07:00
sm750fb video/nomodeset: Select nomodeset= parameter with CONFIG_VIDEO 2024-01-23 10:11:38 +01:00
vc04_services Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
vme_user Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
vt6655 wifi: mac80211: inform the low level if drv_stop() is a suspend 2024-06-26 10:25:46 +02:00
vt6656 Staging driver updates for 6.11-rc1 2024-07-19 15:46:29 -07:00
Kconfig staging: pi433: Remove unused driver 2024-05-04 18:42:43 +02:00
Makefile staging: pi433: Remove unused driver 2024-05-04 18:42:43 +02:00