]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ethtool: re-order local includes
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Thu, 19 Mar 2026 18:05:54 +0000 (19:05 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 21 Mar 2026 02:10:18 +0000 (19:10 -0700)
Most local #include in the ethtool command handling is out of order,
with either :

 #include "netlink.h"
 #include "common.h"

or even :

 #include "netlink.h"
 #include "common.h"
 #include "bitset.h"

One of the reasons is because bitset.h s lacking definitions for
nlattr, netlink_ext_ack, ETH_GSTRING_LEN, and types such as u32, bool,
etc.

Make bitset.h standalone by including <linux/ethtool.h> for
ETH_GSTRING_LEN, and <linux/netlink.h> for nlattr, netlink_ext_ack and
the rest.

While at it, take a pass on ethnl sources to re-order the local
includes :
 - put them after the global includes
 - add a newline between global and local includes
 - alpha-sort the local includes

One notable exception is the cmis.h include, that needs definitions from
module_fw.h. Keep them in this order for now.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260319180555.1531386-1-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
31 files changed:
net/ethtool/bitset.c
net/ethtool/bitset.h
net/ethtool/cabletest.c
net/ethtool/channels.c
net/ethtool/coalesce.c
net/ethtool/common.c
net/ethtool/debug.c
net/ethtool/eee.c
net/ethtool/eeprom.c
net/ethtool/features.c
net/ethtool/fec.c
net/ethtool/ioctl.c
net/ethtool/linkinfo.c
net/ethtool/linkmodes.c
net/ethtool/linkstate.c
net/ethtool/module.c
net/ethtool/mse.c
net/ethtool/netlink.c
net/ethtool/pause.c
net/ethtool/phc_vclocks.c
net/ethtool/phy.c
net/ethtool/plca.c
net/ethtool/privflags.c
net/ethtool/pse-pd.c
net/ethtool/rings.c
net/ethtool/rss.c
net/ethtool/stats.c
net/ethtool/strset.c
net/ethtool/tsconfig.c
net/ethtool/tsinfo.c
net/ethtool/wol.c

index f0883357d12e52745fc74b301342fde41f07d92b..8bb98d3ea3db21ae7f3c5acb4305c9aff39c9d9e 100644 (file)
@@ -2,8 +2,9 @@
 
 #include <linux/ethtool_netlink.h>
 #include <linux/bitmap.h>
-#include "netlink.h"
+
 #include "bitset.h"
+#include "netlink.h"
 
 /* Some bitmaps are internally represented as an array of unsigned long, some
  * as an array of u32 (some even as single u32 for now). To avoid the need of
index c2c2e0051d004665756ffcdf3f78fc481bddeca3..07bc547d47a87719f8027711a4ba9db30a528c75 100644 (file)
@@ -3,6 +3,9 @@
 #ifndef _NET_ETHTOOL_BITSET_H
 #define _NET_ETHTOOL_BITSET_H
 
+#include <linux/ethtool.h>
+#include <linux/netlink.h>
+
 #define ETHNL_MAX_BITSET_SIZE S16_MAX
 
 typedef const char (*const ethnl_string_array_t)[ETH_GSTRING_LEN];
index 0364b8fb577bc3ade49d5937b176dc08c1a02dc5..8d375dac2a406bdedd8e9758f6b57ff37c134ffe 100644 (file)
@@ -3,8 +3,9 @@
 #include <linux/phy.h>
 #include <linux/ethtool_netlink.h>
 #include <net/netdev_lock.h>
-#include "netlink.h"
+
 #include "common.h"
+#include "netlink.h"
 
 /* 802.3 standard allows 100 meters for BaseT cables. However longer
  * cables might work, depending on the quality of the cables and the
index ca4f80282448b680543e1b579adb1de6d67ade11..45232cf1c144cc5fc39891301f0a105bf7b7ba2c 100644 (file)
@@ -2,8 +2,8 @@
 
 #include <net/xdp_sock_drv.h>
 
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 
 struct channels_req_info {
        struct ethnl_req_info           base;
index 349bb02c517a3a18b316ce9fea5404f7c99e5e69..1e2c5c7048a8376da85674e43424531faf147935 100644 (file)
@@ -1,8 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/dim.h>
-#include "netlink.h"
+
 #include "common.h"
+#include "netlink.h"
 
 struct coalesce_req_info {
        struct ethnl_req_info           base;
index e252cf20c22f5bffb6781a65f77f89fe08a67a67..6a4a3797a8127f5de113e8eb4e66bb1107be2cc0 100644 (file)
@@ -8,8 +8,8 @@
 #include <linux/phy_link_topology.h>
 #include <net/netdev_queues.h>
 
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 #include "../core/dev.h"
 
 
index 0b2dea56d46171b9adf471f47cf7e007f58403c5..6043916b440e047a6ab1609852185bd5202a93ac 100644 (file)
@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 
 struct debug_req_info {
        struct ethnl_req_info           base;
index bf398973eb8a0d825261e35324aba55a7133d22f..50d6fcd3661b1cf1edc2246c57a74b373bc0f9aa 100644 (file)
@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 
 struct eee_req_info {
        struct ethnl_req_info           base;
index 3b8209e930fd3ac9e1d4d70bad2a84cbbc38ba0d..caf1e41e676b5319975ac87adb592f4c675ea620 100644 (file)
@@ -2,8 +2,9 @@
 
 #include <linux/ethtool.h>
 #include <linux/sfp.h>
-#include "netlink.h"
+
 #include "common.h"
+#include "netlink.h"
 
 struct eeprom_req_info {
        struct ethnl_req_info   base;
index f2217983be2bdb59800849e2b6898bf9c7b73dc7..d9455b30aec938717a7880eaea33304a78a5f8ce 100644 (file)
@@ -2,9 +2,9 @@
 
 #include <net/netdev_lock.h>
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 
 struct features_req_info {
        struct ethnl_req_info   base;
index 4669e74cbcaaa0b4335449f32bd4ff729e617e92..e2d53927106066080857f1c643637df83a219c3d 100644 (file)
@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 
 struct fec_req_info {
        struct ethnl_req_info           base;
index ff4b4780d6af48161a2a6f931cfe19446053bf54..11dfbf076b6d3da0e816d2ae1e01f42ca5dd90ca 100644 (file)
@@ -33,6 +33,7 @@
 #include <net/flow_offload.h>
 #include <net/netdev_lock.h>
 #include <linux/ethtool_netlink.h>
+
 #include "common.h"
 
 /* State held across locks and calls for commands which have devlink fallback */
index 30b8ce2751594ebdb49c1ebc80e3c7674795ce2a..244ff92e2ff90ba940cac00744b22ba3c84e0646 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 
 struct linkinfo_req_info {
        struct ethnl_req_info           base;
index 259cd9ef1f2a1c1f5d0cb2d7d1d5d34bda42ebbf..30d703531652ba18c13106d0eb35f6d428c92e36 100644 (file)
@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 
 /* LINKMODES_GET */
 
index 05a5f72c99fab14a1ae096b2dd76a10363bc29b6..8a5985fd77123613daef7d87c5dfcd4b7e90a097 100644 (file)
@@ -1,10 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
-#include "common.h"
 #include <linux/phy.h>
 #include <linux/phylib_stubs.h>
 
+#include "common.h"
+#include "netlink.h"
+
 struct linkstate_req_info {
        struct ethnl_req_info           base;
 };
index 0a761bf4771e11c57c907a30180bd36327ccb799..cad2eb25b5a41435683522a60e254d9db050968e 100644 (file)
@@ -6,10 +6,10 @@
 #include <net/devlink.h>
 #include <net/netdev_lock.h>
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
 #include "module_fw.h"
+#include "netlink.h"
 
 struct module_req_info {
        struct ethnl_req_info base;
index 8cb3fc5e7be4fc403713a475fb3f86fa8fd783c5..e91b74430f763f0bb86400e19ea0bfaa7711c9a5 100644 (file)
@@ -4,8 +4,8 @@
 #include <linux/phy.h>
 #include <linux/slab.h>
 
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 
 /* Channels A-D only; WORST and LINK are exclusive alternatives */
 #define PHY_MSE_CHANNEL_COUNT 4
index 6e5f0f4f815a1a697ca87b9df6f9293abb1c04fb..14cb06ec5171d6df90d9f792338232d09a59a812 100644 (file)
@@ -6,8 +6,9 @@
 #include <linux/ethtool_netlink.h>
 #include <linux/phy_link_topology.h>
 #include <linux/pm_runtime.h>
-#include "netlink.h"
+
 #include "module_fw.h"
+#include "netlink.h"
 
 static struct genl_family ethtool_genl_family;
 
index 5d28f642764c37ebaab40199d9e93793a1cb2616..29f812e935b6fc3fa00359bdb4adee574aee20db 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 
 struct pause_req_info {
        struct ethnl_req_info           base;
index cadaabed60bd96be2c4c81560d916df5f607b0c9..15146e38ab2717af8848008936e0f5f9254e8b00 100644 (file)
@@ -2,8 +2,8 @@
 /*
  * Copyright 2021 NXP
  */
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 
 struct phc_vclocks_req_info {
        struct ethnl_req_info           base;
index 68372bef4b2fe2cddda26cf2f5c09420d7c7fb3d..d4e6887055ab15d63331e4c8d6d872286580bf29 100644 (file)
@@ -3,14 +3,14 @@
  * Copyright 2023 Bootlin
  *
  */
-#include "common.h"
-#include "netlink.h"
-
 #include <linux/phy.h>
 #include <linux/phy_link_topology.h>
 #include <linux/sfp.h>
 #include <net/netdev_lock.h>
 
+#include "common.h"
+#include "netlink.h"
+
 struct phy_req_info {
        struct ethnl_req_info base;
 };
index e1f7820a6158f489c8ad55b6c1a3e77dca600ed4..91f0c42332984d987f89f6a56b03b5ac16e80a7d 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/phy.h>
 #include <linux/ethtool_netlink.h>
 
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 
 struct plca_req_info {
        struct ethnl_req_info           base;
index 297be6a13ab9a8af7b0bdee14fe5bb3b84117d59..46a4d2a43ba80e1bdac5ed139f0e4b81d3fae401 100644 (file)
@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 
 struct privflags_req_info {
        struct ethnl_req_info           base;
index 24def9c9dd54bf8d388f2e938235afbc6ad631b8..2eb9bdc2dcb904f4e7953f7ea3b8e144215796b6 100644 (file)
@@ -6,14 +6,15 @@
 // Copyright (c) 2022 Pengutronix, Oleksij Rempel <kernel@pengutronix.de>
 //
 
-#include "common.h"
-#include "linux/pse-pd/pse.h"
-#include "netlink.h"
 #include <linux/ethtool_netlink.h>
 #include <linux/ethtool.h>
 #include <linux/export.h>
 #include <linux/phy.h>
 
+#include "common.h"
+#include "linux/pse-pd/pse.h"
+#include "netlink.h"
+
 struct pse_req_info {
        struct ethnl_req_info base;
 };
index aeedd5ec6b8cdfc298042587172d78d0ef3d36a3..0fd5dcc3729f8f3d61ccedce39a53ded68bb8e35 100644 (file)
@@ -2,8 +2,8 @@
 
 #include <net/netdev_queues.h>
 
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 
 struct rings_req_info {
        struct ethnl_req_info           base;
index da5934cceb0757d53b2b30efa6e238314c4d27db..0f4e5cd2ac71a035e64f7c6bf86d697d418a1e5f 100644 (file)
@@ -2,8 +2,8 @@
 
 #include <net/netdev_lock.h>
 
-#include "netlink.h"
 #include "common.h"
+#include "netlink.h"
 
 struct rss_req_info {
        struct ethnl_req_info           base;
index 3ca8eb2a3b314ae675beb37106a45a8c97cf4309..38136f19b2eca7cf8d703bbb64851f7b4c325d30 100644 (file)
@@ -3,9 +3,9 @@
 #include <linux/phy.h>
 #include <linux/phylib_stubs.h>
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 
 struct stats_req_info {
        struct ethnl_req_info           base;
index f6a67109beda1bcb7e77ad23443981c3f6ed0f0b..aa1e50c98f3480e8cb883adf07a5bb5548d50aa2 100644 (file)
@@ -2,8 +2,9 @@
 
 #include <linux/ethtool.h>
 #include <linux/phy.h>
-#include "netlink.h"
+
 #include "common.h"
+#include "netlink.h"
 
 struct strset_info {
        bool per_dev;
index e49e612a68c2c0a9655bd34b5634dc1ac68f37c1..e4f518e49d4cb01d620c2949cfa91dd9785f5b8e 100644 (file)
@@ -3,11 +3,11 @@
 #include <linux/net_tstamp.h>
 #include <linux/ptp_clock_kernel.h>
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
-#include "../core/dev.h"
+#include "common.h"
+#include "netlink.h"
 #include "ts.h"
+#include "../core/dev.h"
 
 struct tsconfig_req_info {
        struct ethnl_req_info base;
index c0145c752d2f8b4abd269218de83420573b7a30b..9aad62695dfb3493419c23d40fd6e33d5360f977 100644 (file)
@@ -6,9 +6,9 @@
 #include <linux/ptp_clock_kernel.h>
 #include <net/netdev_lock.h>
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 #include "ts.h"
 
 struct tsinfo_req_info {
index a39d8000d808ae4cd60dae268afdee5a436c5215..60f9a1d8535e282af3f9bdae2c7708574b12d200 100644 (file)
@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
-#include "netlink.h"
-#include "common.h"
 #include "bitset.h"
+#include "common.h"
+#include "netlink.h"
 
 struct wol_req_info {
        struct ethnl_req_info           base;