linux-yocto/arch
Linus Torvalds ab55a0c6a5 minmax: add a few more MIN_T/MAX_T users
commit 4477b39c32 upstream.

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>
Signed-off-by: Eliav Farber <farbere@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-10-02 13:40:43 +02:00
..
alpha alpha/elf: Fix misc/setarch test of util-linux by removing 32bit support 2025-03-28 21:58:51 +01:00
arc ARC: build: Try to guess GCC variant of cross compiler 2025-01-09 13:30:05 +01:00
arm minmax: add in_range() macro 2025-10-02 13:40:41 +02:00
arm64 arm64: dts: imx8mp: Correct thermal sensor index 2025-10-02 13:40:37 +02:00
csky mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
hexagon hexagon: Fix unbalanced spinlock in die() 2025-02-21 13:49:25 +01:00
ia64 mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
loongarch LoongArch: Check the return value when creating kobj 2025-09-25 10:58:52 +02:00
m68k m68k: Fix lost column on framebuffer debug console 2025-08-28 16:26:05 +02:00
microblaze microblaze: Export xmb_manager functions 2024-12-14 19:53:20 +01:00
mips mips: lantiq: xway: sysctrl: rename the etop node 2025-09-04 15:26:24 +02:00
nios2 mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
openrisc mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
parisc parisc: Update comments in make_insert_tlb 2025-08-28 16:26:08 +02:00
powerpc powerpc/kvm: Fix ifdef to remove build warning 2025-09-04 15:26:26 +02:00
riscv RISC-V: KVM: Don't treat SBI HFENCE calls as NOPs 2025-06-27 11:07:41 +01:00
s390 s390/cpum_cf: Fix uninitialized warning after backport of ce971233242b 2025-10-02 13:40:41 +02:00
sh sh: Do not use hyphen in exported variable name 2025-08-15 12:05:04 +02:00
sparc sparc/mm: disable preemption in lazy mmu mode 2025-04-25 10:43:42 +02:00
um minmax: make generic MIN() and MAX() macros available everywhere 2025-10-02 13:40:43 +02:00
x86 minmax: add a few more MIN_T/MAX_T users 2025-10-02 13:40:43 +02:00
xtensa mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
.gitignore
Kconfig