[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220408200337.718067-2-vladimir.oltean@nxp.com>
Date: Fri, 8 Apr 2022 23:03:32 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org
Cc: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
UNGLinuxDriver@...rochip.com, Paolo Abeni <pabeni@...hat.com>,
Roopa Prabhu <roopa@...dia.com>,
Nikolay Aleksandrov <nikolay@...dia.com>,
Jiri Pirko <jiri@...dia.com>, Ido Schimmel <idosch@...dia.com>,
Tobias Waldekranz <tobias@...dekranz.com>,
Mattias Forsblad <mattias.forsblad@...il.com>
Subject: [PATCH net-next 1/6] net: refactor all NETDEV_CHANGE notifier calls to a single function
Create a __netdev_state_change() helper function which emits a
NETDEV_CHANGE notifier with the given changed flags as argument.
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
net/core/dev.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index e027410e861b..433f006a796b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1314,6 +1314,19 @@ void netdev_features_change(struct net_device *dev)
}
EXPORT_SYMBOL(netdev_features_change);
+static void __netdev_state_change(struct net_device *dev,
+ unsigned int flags_changed)
+{
+ struct netdev_notifier_change_info change_info = {
+ .info = {
+ .dev = dev,
+ },
+ .flags_changed = flags_changed,
+ };
+
+ call_netdevice_notifiers_info(NETDEV_CHANGE, &change_info.info);
+}
+
/**
* netdev_state_change - device changes state
* @dev: device to cause notification
@@ -1325,12 +1338,7 @@ EXPORT_SYMBOL(netdev_features_change);
void netdev_state_change(struct net_device *dev)
{
if (dev->flags & IFF_UP) {
- struct netdev_notifier_change_info change_info = {
- .info.dev = dev,
- };
-
- call_netdevice_notifiers_info(NETDEV_CHANGE,
- &change_info.info);
+ __netdev_state_change(dev, 0);
rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
}
}
@@ -8479,16 +8487,8 @@ void __dev_notify_flags(struct net_device *dev, unsigned int old_flags,
}
if (dev->flags & IFF_UP &&
- (changes & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | IFF_VOLATILE))) {
- struct netdev_notifier_change_info change_info = {
- .info = {
- .dev = dev,
- },
- .flags_changed = changes,
- };
-
- call_netdevice_notifiers_info(NETDEV_CHANGE, &change_info.info);
- }
+ (changes & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | IFF_VOLATILE)))
+ __netdev_state_change(dev, changes);
}
/**
--
2.25.1
Powered by blists - more mailing lists