提交 bb896805 编写于 作者: P Petr Machata 提交者: David S. Miller

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: NPetr Machata <petrm@mellanox.com>
Acked-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2b239f67
......@@ -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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册