Skip to content

Commit bb89680

Browse files
pmachatadavem330
authored andcommitted
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>
1 parent 2b239f6 commit bb89680

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • drivers/staging/fsl-dpaa2/ethsw

‎drivers/staging/fsl-dpaa2/ethsw/ethsw.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,11 @@ static int port_bridge_leave(struct net_device *netdev)
972972
return err;
973973
}
974974

975+
static bool ethsw_port_dev_check(const struct net_device *netdev)
976+
{
977+
return netdev->netdev_ops == &ethsw_port_ops;
978+
}
979+
975980
static int port_netdevice_event(struct notifier_block *unused,
976981
unsigned long event, void *ptr)
977982
{
@@ -980,7 +985,7 @@ static int port_netdevice_event(struct notifier_block *unused,
980985
struct net_device *upper_dev;
981986
int err = 0;
982987

983-
if (netdev->netdev_ops != &ethsw_port_ops)
988+
if (!ethsw_port_dev_check(netdev))
984989
return NOTIFY_DONE;
985990

986991
/* Handle just upper dev link/unlink for the moment */

0 commit comments

Comments
 (0)