]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ethtool: uapi: Use UAPI definition of INT_MAX
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Tue, 13 Jan 2026 07:44:18 +0000 (08:44 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 17 Jan 2026 23:24:05 +0000 (15:24 -0800)
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>
include/uapi/linux/ethtool.h

index bbfe6e1cf01b09fd6a6ab6cbb0e7a8dad301ed27..ce9aeb65a8e14ada945b900caa1f06768c034acf 100644 (file)
 #define _UAPI_LINUX_ETHTOOL_H
 
 #include <linux/const.h>
+#include <linux/typelimits.h>
 #include <linux/types.h>
 #include <linux/if_ether.h>
 
-#ifndef __KERNEL__
-#include <limits.h> /* for INT_MAX */
-#endif
-
 /* All structures exposed to userland should be defined such that they
  * have the same layout for 32-bit and 64-bit userland.
  */
@@ -2216,7 +2213,7 @@ enum ethtool_link_mode_bit_indices {
 
 static inline int ethtool_validate_speed(__u32 speed)
 {
-       return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN;
+       return speed <= __KERNEL_INT_MAX || speed == (__u32)SPEED_UNKNOWN;
 }
 
 /* Duplex, half or full. */