aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2018-11-22 23:29:18 +0000
committerDavid S. Miller <davem@davemloft.net>2018-11-23 18:02:24 -0800
commitbb896805611fae33a67edb20820147b8a9ca68a5 (patch)
tree732a4d351de3fba5acd147e702e78955969f249b /drivers/staging
parentnet: dsa: slave: Handle SWITCHDEV_PORT_OBJ_ADD/_DEL (diff)
downloadlinux-dev-bb896805611fae33a67edb20820147b8a9ca68a5.tar.xz
linux-dev-bb896805611fae33a67edb20820147b8a9ca68a5.zip
staging: fsl-dpaa2: ethsw: Introduce ethsw_port_dev_check()
ethsw currently uses an open-coded comparison of netdev_ops to determine whether whether a device represents a front panel port. Wrap this into a named function to simplify reuse. Signed-off-by: Petr Machata <petrm@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/fsl-dpaa2/ethsw/ethsw.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 7a7ca67822c5..e379b0fa936f 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -972,6 +972,11 @@ static int port_bridge_leave(struct net_device *netdev)
return err;
}
+static bool ethsw_port_dev_check(const struct net_device *netdev)
+{
+ return netdev->netdev_ops == &ethsw_port_ops;
+}
+
static int port_netdevice_event(struct notifier_block *unused,
unsigned long event, void *ptr)
{
@@ -980,7 +985,7 @@ static int port_netdevice_event(struct notifier_block *unused,
struct net_device *upper_dev;
int err = 0;
- if (netdev->netdev_ops != &ethsw_port_ops)
+ if (!ethsw_port_dev_check(netdev))
return NOTIFY_DONE;
/* Handle just upper dev link/unlink for the moment */