linux/drivers
Linus Torvalds 4477b39c32 minmax: add a few more MIN_T/MAX_T users
Commit 3a7e02c040 ("minmax: avoid overly complicated constant
expressions in VM code") added the simpler MIN_T/MAX_T macros in order
to avoid some excessive expansion from the rather complicated regular
min/max macros.

The complexity of those macros stems from two issues:

 (a) trying to use them in situations that require a C constant
     expression (in static initializers and for array sizes)

 (b) the type sanity checking

and MIN_T/MAX_T avoids both of these issues.

Now, in the whole (long) discussion about all this, it was pointed out
that the whole type sanity checking is entirely unnecessary for
min_t/max_t which get a fixed type that the comparison is done in.

But that still leaves min_t/max_t unnecessarily complicated due to
worries about the C constant expression case.

However, it turns out that there really aren't very many cases that use
min_t/max_t for this, and we can just force-convert those.

This does exactly that.

Which in turn will then allow for much simpler implementations of
min_t()/max_t().  All the usual "macros in all upper case will evaluate
the arguments multiple times" rules apply.

We should do all the same things for the regular min/max() vs MIN/MAX()
cases, but that has the added complexity of various drivers defining
their own local versions of MIN/MAX, so that needs another level of
fixes first.

Link: https://lore.kernel.org/all/b47fad1d0cf8449886ad148f8c013dae@AcuMS.aculab.com/
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 13:41:14 -07:00
..
accel
accessibility
acpi RISC-V Patches for the 6.11 Merge Window, Part 2 2024-07-27 10:14:34 -07:00
amba
android
ata
atm
auxdisplay auxdisplay updates for v6.11 2024-07-26 11:04:28 -07:00
base regmap: Fix for v6.11 2024-07-27 12:26:09 -07:00
bcma
block block-6.11-20240726 2024-07-27 15:28:53 -07:00
bluetooth
bus Devicetree fixes for 6.11, part 1 2024-07-27 12:46:16 -07:00
cache
cdrom
cdx
char
clk Devicetree fixes for 6.11, part 1 2024-07-27 12:46:16 -07:00
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto
cxl CXL for v6.11 merge window 2024-07-28 09:33:28 -07:00
dax
dca
devfreq
dio
dma
dma-buf
dpll
edac minmax: add a few more MIN_T/MAX_T users 2024-07-28 13:41:14 -07:00
eisa
extcon
firewire
firmware RISC-V Patches for the 6.11 Merge Window, Part 2 2024-07-27 10:14:34 -07:00
fpga
fsi
gnss
gpio gpio fixes for v6.11-rc1 2024-07-27 12:54:06 -07:00
gpu minmax: add a few more MIN_T/MAX_T users 2024-07-28 13:41:14 -07:00
greybus
hid
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c
i3c I3C for 6.11 2024-07-27 10:53:06 -07:00
idle
iio
infiniband
input
interconnect
iommu IOMMU Fixes for Linux v6.11-rc1 2024-07-27 12:39:55 -07:00
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md minmax: add a few more MIN_T/MAX_T users 2024-07-28 13:41:14 -07:00
media a couple of leaks on failure exits missing fdput() 2024-07-26 10:26:33 -07:00
memory
memstick
message
mfd Devicetree fixes for 6.11, part 1 2024-07-27 12:46:16 -07:00
misc
mmc
most
mtd This pull request contains updates (actually, just fixes) for UBI and UBIFS: 2024-07-28 11:51:51 -07:00
mux
net minmax: add a few more MIN_T/MAX_T users 2024-07-28 13:41:14 -07:00
nfc
ntb
nubus
nvdimm
nvme nvme fixes for Linux 6.11 2024-07-26 08:06:15 -06:00
nvmem
of
opp
parisc
parport
pci
pcmcia
peci
perf RISC-V Patches for the 6.11 Merge Window, Part 2 2024-07-27 10:14:34 -07:00
phy
pinctrl
platform
pmdomain
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator regulator: Fixes for v6.11 2024-07-27 12:27:52 -07:00
remoteproc
reset
rpmsg
rtc
s390 more s390 updates for 6.11 merge window 2024-07-26 10:47:53 -07:00
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi spi: Fixes for v6.11 2024-07-27 12:29:10 -07:00
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty Devicetree fixes for 6.11, part 1 2024-07-27 12:46:16 -07:00
ufs
uio
usb Devicetree fixes for 6.11, part 1 2024-07-27 12:46:16 -07:00
vdpa
vfio
vhost
video
virt
virtio
w1
watchdog
xen
zorro
Kconfig
Makefile