2017-09-20 01:00:54

by Florian Fainelli

[permalink] [raw]
Subject: [PATCH net-next] net: dsa: Utilize dsa_slave_dev_check()

Instead of open coding the check.

Signed-off-by: Florian Fainelli <[email protected]>
---
net/dsa/slave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index d51b10450e1b..6fc9eb094267 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1294,7 +1294,7 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb,
{
struct net_device *dev = netdev_notifier_info_to_dev(ptr);

- if (dev->netdev_ops != &dsa_slave_netdev_ops)
+ if (!dsa_slave_dev_check(dev))
return NOTIFY_DONE;

if (event == NETDEV_CHANGEUPPER)
--
2.9.3


2017-09-20 14:23:14

by Vivien Didelot

[permalink] [raw]
Subject: Re: [PATCH net-next] net: dsa: Utilize dsa_slave_dev_check()

Hi Florian,

Florian Fainelli <[email protected]> writes:

> Instead of open coding the check.
>
> Signed-off-by: Florian Fainelli <[email protected]>

If we do need to use it outside one day, we may think about renaming
netdev_uses_dsa() to netdev_is_dsa_master() and renaming
dsa_slave_dev_check() to netdev_is_dsa_slave().

In the meantime, looks good!

Reviewed-by: Vivien Didelot <[email protected]>

2017-09-20 22:49:41

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net-next] net: dsa: Utilize dsa_slave_dev_check()

From: Florian Fainelli <[email protected]>
Date: Tue, 19 Sep 2017 18:00:37 -0700

> Instead of open coding the check.
>
> Signed-off-by: Florian Fainelli <[email protected]>

Applied, thanks.