Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ethtool: uapi: Use UAPI definition of INT_MAX

Using <limits.h> to gain access to INT_MAX introduces a dependency on a
libc, which UAPI headers should not do.

Use the equivalent UAPI constant.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://patch.msgid.link/20260113-uapi-limits-v2-2-93c20f4b2c1a@linutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Thomas Weißschuh and committed by
Jakub Kicinski
a8a11e52 ca9d74eb

+2 -5
+2 -5
include/uapi/linux/ethtool.h
··· 15 15 #define _UAPI_LINUX_ETHTOOL_H 16 16 17 17 #include <linux/const.h> 18 + #include <linux/typelimits.h> 18 19 #include <linux/types.h> 19 20 #include <linux/if_ether.h> 20 - 21 - #ifndef __KERNEL__ 22 - #include <limits.h> /* for INT_MAX */ 23 - #endif 24 21 25 22 /* All structures exposed to userland should be defined such that they 26 23 * have the same layout for 32-bit and 64-bit userland. ··· 2213 2216 2214 2217 static inline int ethtool_validate_speed(__u32 speed) 2215 2218 { 2216 - return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN; 2219 + return speed <= __KERNEL_INT_MAX || speed == (__u32)SPEED_UNKNOWN; 2217 2220 } 2218 2221 2219 2222 /* Duplex, half or full. */