History

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.

Thomas Weißschuh committed 10 months ago

Commit a8a11e51 parent ca9d74e1 file · +2 −5Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/linux/ethtool.h+2−5
@@ -15,13 +15,10 @@ · 14 unmodified lines
1515 #define _UAPI_LINUX_ETHTOOL_H
1616
1717 #include <linux/const.h>
18+#include <linux/typelimits.h>
1819 #include <linux/types.h>
1920 #include <linux/if_ether.h>
2021
21−#ifndef __KERNEL__
22−#include <limits.h> /* for INT_MAX */
23−#endif
24−
2522 /* All structures exposed to userland should be defined such that they
2623 * have the same layout for 32-bit and 64-bit userland.
2724 */
@@ -2216,7 +2213,7 @@ enum ethtool_link_mode_bit_indices { · 2188 unmodified lines
22162213
22172214 static inline int ethtool_validate_speed(__u32 speed)
22182215 {
2219− return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN;
2216+ return speed <= __KERNEL_INT_MAX || speed == (__u32)SPEED_UNKNOWN;
22202217 }
22212218
22222219 /* Duplex, half or full. */