Backport minmax.h updates from v6.17-rc7
Status from this message: This is a note to let you know that I've just added the patch titled
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest11 patches 11 repliesApplied
- v311 patches 0 repliesSuperseded
- v2 posting 2/213 patches 2 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 posting 1/2 | 12 patches | 1 reply | Superseded | |
| v1 | 19 patches | 12 replies | Applied |
Changes in v4 from the cover letter
- Just swap the order of the first 2 patches in this chain, because commit cb04e8b1d2f2 ("minmax: don't use max() in situations that want a C constant expression") should come before commit dc1c8034e31b ("minmax: simplify min()/max()/clamp() implementation").
Patches in v4 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/11 | minmax: don't use max() in situations that want a C constant expressiondrivers/ drivers/ drivers/ +3 more | +6 | 1 reply | |
| 2/11 | minmax: simplify min()/max()/clamp() implementationinclude/ | +20 | 1 reply | |
| 3/11 | minmax: improve macro expansion and type checkinginclude/ include/ | +68 | 1 reply | |
| 4/11 | minmax: fix up min3() and max3() tooinclude/ | +10 | 1 reply | |
| 5/11 | minmax.h: add whitespace around operators and after commasinclude/ | +17 | 1 reply | |
| 6/11 | minmax.h: update some commentsinclude/ | +24 | 1 reply | |
| 7/11 | minmax.h: reduce the #define expansion of min(), max() and clamp()include/ | +12 | 1 reply | |
| 8/11 | minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()include/ | +1 | 1 reply | |
| 9/11 | minmax.h: move all the clamp() definitions after the min/max() onesinclude/ | +51 | 1 reply | |
| 10/11 | minmax.h: simplify the variants of clamp()include/ | +12 | 1 reply | |
| 11/11 | minmax.h: remove some #defines that are only expanded onceinclude/ | +6 | 1 reply |
Reviews trailers per patch
1 of 11 patches has a Reviewed-by or Acked-by.
| Patch | David Laight | Arnd Bergmann |
|---|---|---|
| 1/11 | ||
| 2/11 | ||
| 3/11 | ||
| 4/11 | Requested-by Requested-by | A-b A-b |
| 5/11 | ||
| 6/11 | ||
| 7/11 | ||
| 8/11 | ||
| 9/11 | ||
| 10/11 | ||
| 11/11 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 00/11 6.1.y] Backport minmax.h updates from v6.17-rc7
This series backports 11 patches to update minmax.h in the 6.1.y branch, aligning it with v6.17-rc7.
The ultimate goal is to synchronize all longterm branches so that they include the full set of minmax.h changes (6.12.y and 6.6.y were already backported by me and are now aligned).
The key motivation is to bring in commit d03eba99f5bf ("minmax: allow min()/max()/clamp() if the arguments have the same signedness"), which is missing in older kernels.
In mainline, this change enables min()/max()/clamp() to accept mixed argument types, provided both have the same signedness. Without it, backported patches that use these forms may trigger compiler warnings, which escalate to build failures when -Werror is enabled.
Changes in v4:
- Just swap the order of the first 2 patches in this chain, because commit cb04e8b1d2f2 ("minmax: don't use max() in situations that want a C constant expression") should come before commit dc1c8034e31b ("minmax: simplify min()/max()/clamp() implementation").
Changes in v3:
- v2 included 13 patches:
https://lore.kernel.org/stable/[email protected]/
- First 2 were accepted and are part of 6.1.155.
- 3rd caused build in drivers/md/ to fail:
In file included from ./include/linux/container_of.h:5,
from ./include/linux/list.h:5,
from ./include/linux/wait.h:7,
from ./include/linux/mempool.h:8,
from ./include/linux/bio.h:8,
from drivers/md/dm-bio-record.h:10,
from drivers/md/dm-integrity.c:9:drivers/md/dm-integrity.c: In function ‘integrity_metadata’:drivers/md/dm-integrity.c:131:105: error: ISO C90 forbids variable length array ‘checksums_onstack’ [-Werror=vla]
131 | #define MAX_TAG_SIZE (JOURNAL_SECTOR_DATA - JOURNAL_MAC_PER_SECTOR - offsetof(struct journal_entry, last_bytes[MAX_SECTORS_PER_BLOCK]))
| ^~~~~~~~~~~~~./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~./include/linux/minmax.h:56:9: note: in expansion of macro ‘static_assert’
56 | static_assert(__types_ok(x, y, ux, uy), \
| ^~~~~~~~~~~~~
./include/linux/minmax.h:41:31: note: in expansion of macro ‘__is_noneg_int’
41 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
./include/linux/minmax.h:56:23: note: in expansion of macro ‘__types_ok’
56 | static_assert(__types_ok(x, y, ux, uy), \
| ^~~~~~~~~~
./include/linux/minmax.h:61:9: note: in expansion of macro ‘__careful_cmp_once’
61 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
| ^~~~~~~~~~~~~~~~~~
./include/linux/minmax.h:92:25: note: in expansion of macro ‘__careful_cmp’
92 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~drivers/md/dm-integrity.c:1797:40: note: in expansion of macro ‘max’
1797 | char checksums_onstack[max((size_t)HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)];
| ^~~drivers/md/dm-integrity.c:131:89: note: in expansion of macro ‘offsetof’
131 | #define MAX_TAG_SIZE (JOURNAL_SECTOR_DATA - JOURNAL_MAC_PER_SECTOR - offsetof(struct journal_entry, last_bytes[MAX_SECTORS_PER_BLOCK]))
| ^~~~~~~~drivers/md/dm-integrity.c:1797:73: note: in expansion of macro ‘MAX_TAG_SIZE’
1797 | char checksums_onstack[max((size_t)HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)];
| ^~~~~~~~~~~~
- The build was fixed in the second patch of this series.
Changes in v2:
- v1 included 19 patches:
https://lore.kernel.org/stable/[email protected]/
- First 6 were pushed to the stable-tree.
- 7th cauded amd driver's build to fail.
- This change fixes it.
- Modified files:
drivers/gpu/drm/amd/amdgpu/amdgpu.h drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
David Laight (7):
minmax.h: add whitespace around operators and after commas minmax.h: update some comments
minmax.h: reduce the #define expansion of min(), max() and clamp() minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp() minmax.h: move all the clamp() definitions after the min/max() ones minmax.h: simplify the variants of clamp()
minmax.h: remove some #defines that are only expanded once
Linus Torvalds (4):
minmax: don't use max() in situations that want a C constant
expression
minmax: simplify min()/max()/clamp() implementation
minmax: improve macro expansion and type checking
minmax: fix up min3() and max3() too
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- drivers/input/touchscreen/cyttsp4_core.c | 2 +- drivers/irqchip/irq-sun6i-r.c | 2 +- drivers/md/dm-integrity.c | 2 +- fs/btrfs/tree-checker.c | 2 +- include/linux/compiler.h | 9 + include/linux/minmax.h | 222 +++++++++++++---------- lib/vsprintf.c | 2 +- 8 files changed, 143 insertions(+), 100 deletions(-)
Signature · 1 line
2.47.3