[PATCH net-next v2 8/8] net: s/dev_close_many/netif_close_many/

Stanislav Fomichev
2025-06-30T16:42:37Z

netif_close_many is used only by vlan/dsa and one mtk driver, so move it into
NETDEV_INTERNAL namespace.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 +++-
include/linux/netdevice.h | 2 +-
net/8021q/vlan.c | 4 +++-
net/core/dev.c | 10 +++++-----
net/dsa/dsa.c | 4 +++-
net/dsa/user.c | 4 +++-
6 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index f8a907747db4..004ece722a83 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -31,6 +31,8 @@
#include "mtk_eth_soc.h"
#include "mtk_wed.h"

+MODULE_IMPORT_NS("NETDEV_INTERNAL");
+
static int mtk_msg_level = -1;
module_param_named(msg_level, mtk_msg_level, int, 0);
MODULE_PARM_DESC(msg_level, "Message level (-1=defaults,0=none,...,16=all)");
@@ -4960,7 +4962,7 @@ void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev)
list_add_tail(&dev->close_list, &dev_list);
}

- dev_close_many(&dev_list, false);
+ netif_close_many(&dev_list, false);

eth->dma_dev = dma_dev;

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 558b29d34f2e..e5aae0ecf138 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3344,7 +3344,7 @@ int netif_open(struct net_device *dev, struct netlink_ext_ack *extack);
int dev_open(struct net_device *dev, struct netlink_ext_ack *extack);
void netif_close(struct net_device *dev);
void dev_close(struct net_device *dev);
-void dev_close_many(struct list_head *head, bool unlink);
+void netif_close_many(struct list_head *head, bool unlink);
void netif_disable_lro(struct net_device *dev);
void dev_disable_lro(struct net_device *dev);
int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index df19a9c0c9d9..0296239dd7e7 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -35,6 +35,8 @@
#include "vlan.h"
#include "vlanproc.h"

+MODULE_IMPORT_NS("NETDEV_INTERNAL");
+
#define DRV_VERSION "1.8"

/* Global VLAN variables */
@@ -446,7 +448,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
list_add(&vlandev->close_list, &close_list);
}

- dev_close_many(&close_list, false);
+ netif_close_many(&close_list, false);

list_for_each_entry_safe(vlandev, tmp, &close_list, close_list) {
vlan_stacked_transfer_operstate(dev, vlandev,
diff --git a/net/core/dev.c b/net/core/dev.c
index 13ad0faac996..9a9617f6844a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1769,7 +1769,7 @@ static void __dev_close(struct net_device *dev)
list_del(&single);
}

-void dev_close_many(struct list_head *head, bool unlink)
+void netif_close_many(struct list_head *head, bool unlink)
{
struct net_device *dev, *tmp;

@@ -1787,7 +1787,7 @@ void dev_close_many(struct list_head *head, bool unlink)
list_del_init(&dev->close_list);
}
}
-EXPORT_SYMBOL(dev_close_many);
+EXPORT_SYMBOL_NS_GPL(netif_close_many, "NETDEV_INTERNAL");

void netif_close(struct net_device *dev)
{
@@ -1795,7 +1795,7 @@ void netif_close(struct net_device *dev)
LIST_HEAD(single);

list_add(&dev->close_list, &single);
- dev_close_many(&single, true);
+ netif_close_many(&single, true);
list_del(&single);
}
}
@@ -12076,7 +12076,7 @@ void unregister_netdevice_many_notify(struct list_head *head,
netdev_lock(dev);
}
}
- dev_close_many(&close_head, true);
+ netif_close_many(&close_head, true);
/* ... now unlock them and go over the rest. */
list_for_each_entry(dev, head, unreg_list) {
if (netdev_need_ops_lock(dev))
@@ -12084,7 +12084,7 @@ void unregister_netdevice_many_notify(struct list_head *head,
else
list_add_tail(&dev->close_list, &close_head);
}
- dev_close_many(&close_head, true);
+ netif_close_many(&close_head, true);

list_for_each_entry(dev, head, unreg_list) {
/* And unlink it from device chain. */
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 436a7e1b412a..1d906f96bddc 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -28,6 +28,8 @@
#include "tag.h"
#include "user.h"

+MODULE_IMPORT_NS("NETDEV_INTERNAL");
+
#define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG

static DEFINE_MUTEX(dsa2_mutex);
@@ -1621,7 +1623,7 @@ void dsa_switch_shutdown(struct dsa_switch *ds)
dsa_switch_for_each_cpu_port(dp, ds)
list_add(&dp->conduit->close_list, &close_list);

- dev_close_many(&close_list, true);
+ netif_close_many(&close_list, true);

dsa_switch_for_each_user_port(dp, ds) {
conduit = dsa_port_to_conduit(dp);
diff --git a/net/dsa/user.c b/net/dsa/user.c
index e9334520c54a..59ea36802434 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -31,6 +31,8 @@
#include "tag.h"
#include "user.h"

+MODULE_IMPORT_NS("NETDEV_INTERNAL");
+
struct dsa_switchdev_event_work {
struct net_device *dev;
struct net_device *orig_dev;
@@ -3604,7 +3606,7 @@ static int dsa_user_netdevice_event(struct notifier_block *nb,
list_add(&dp->user->close_list, &close_list);
}

- dev_close_many(&close_list, true);
+ netif_close_many(&close_list, true);

return NOTIFY_OK;
}
--
2.49.0