Re: [PATCH v2 07/19 5.15.y] minmax: simplify and clarify min_t()/max_t() implementation
Greg KH <[email protected]>
| Newsgroups | org.kernel.vger.linux-sparse,dev.linux.lists.linux-staging,dev.linux.lists.linux-sunxi,org.freedesktop.lists.amd-gfx,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-um,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-edac,org.kernel.vger.linux-ext4,org.kernel.vger.linux-hwmon,org.kernel.vger.linux-input,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-media,org.kernel.vger.linux-scsi,org.kernel.vger.netdev,org.kernel.vger.netfilter-devel,org.kernel.vger.platform-driver-x86,org.kernel.vger.stable,org.kvack.linux-mm |
|---|---|
| Message-ID | <2025100648-capable-register-101b@gregkh> |
On Fri, Oct 03, 2025 at 12:59:54PM +0000, Eliav Farber wrote: > From: Linus Torvalds <[email protected]> > > [ Upstream commit 017fa3e89187848fd056af757769c9e66ac3e93d ] > > This simplifies the min_t() and max_t() macros by no longer making them > work in the context of a C constant expression. > > That means that you can no longer use them for static initializers or > for array sizes in type definitions, but there were only a couple of > such uses, and all of them were converted (famous last words) to use > MIN_T/MAX_T instead. > > Cc: David Laight <[email protected]> > Cc: Lorenzo Stoakes <[email protected]> > Signed-off-by: Linus Torvalds <[email protected]> > Signed-off-by: Eliav Farber <[email protected]> Eliav, your testing infrastructure needs some work, this patch breaks the build on this kernel tree: In file included from ./include/linux/kernel.h:16, from ./include/linux/list.h:9, from ./include/linux/wait.h:7, from ./include/linux/wait_bit.h:8, from ./include/linux/fs.h:6, from fs/erofs/internal.h:10, from fs/erofs/zdata.h:9, from fs/erofs/zdata.c:6: fs/erofs/zdata.c: In function ‘z_erofs_decompress_pcluster’: fs/erofs/zdata.h:185:61: error: ISO C90 forbids variable length array ‘pages_onstack’ [-Werror=vla] 185 | min_t(unsigned int, THREAD_SIZE / 8 / sizeof(struct page *), 96U) | ^~~~ ./include/linux/minmax.h:49:23: note: in definition of macro ‘__cmp_once_unique’ 49 | ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) | ^ ./include/linux/minmax.h:164:27: note: in expansion of macro ‘__cmp_once’ 164 | #define min_t(type, x, y) __cmp_once(min, type, x, y) | ^~~~~~~~~~ fs/erofs/zdata.h:185:9: note: in expansion of macro ‘min_t’ 185 | min_t(unsigned int, THREAD_SIZE / 8 / sizeof(struct page *), 96U) | ^~~~~ fs/erofs/zdata.c:847:36: note: in expansion of macro ‘Z_EROFS_VMAP_ONSTACK_PAGES’ 847 | struct page *pages_onstack[Z_EROFS_VMAP_ONSTACK_PAGES]; | ^~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors I'll drop this whole series, please do a bit more testing before sending out a new version. thanks, greg k-h