Commit 7e38b03f authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net: mscc: ocelot: remove duplicate ocelot_port_dev_check

A helper for checking whether a net_device belongs to mscc_ocelot
already existed and did not need to be rewritten. Use it.

Fixes: 319e4dd1 ("net: mscc: ocelot: introduce conversion helpers between port and netdev")
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20201011092041.3535101-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c93c5482
...@@ -669,7 +669,8 @@ struct net_device *ocelot_port_to_netdev(struct ocelot *ocelot, int port) ...@@ -669,7 +669,8 @@ struct net_device *ocelot_port_to_netdev(struct ocelot *ocelot, int port)
return priv->dev; return priv->dev;
} }
static bool ocelot_port_dev_check(const struct net_device *dev) /* Checks if the net_device instance given to us originates from our driver */
static bool ocelot_netdevice_dev_check(const struct net_device *dev)
{ {
return dev->netdev_ops == &ocelot_port_netdev_ops; return dev->netdev_ops == &ocelot_port_netdev_ops;
} }
...@@ -678,7 +679,7 @@ int ocelot_netdev_to_port(struct net_device *dev) ...@@ -678,7 +679,7 @@ int ocelot_netdev_to_port(struct net_device *dev)
{ {
struct ocelot_port_private *priv; struct ocelot_port_private *priv;
if (!dev || !ocelot_port_dev_check(dev)) if (!dev || !ocelot_netdevice_dev_check(dev))
return -EINVAL; return -EINVAL;
priv = netdev_priv(dev); priv = netdev_priv(dev);
...@@ -907,12 +908,6 @@ static int ocelot_port_obj_del(struct net_device *dev, ...@@ -907,12 +908,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
return ret; return ret;
} }
/* Checks if the net_device instance given to us originate from our driver. */
static bool ocelot_netdevice_dev_check(const struct net_device *dev)
{
return dev->netdev_ops == &ocelot_port_netdev_ops;
}
static int ocelot_netdevice_port_event(struct net_device *dev, static int ocelot_netdevice_port_event(struct net_device *dev,
unsigned long event, unsigned long event,
struct netdev_notifier_changeupper_info *info) struct netdev_notifier_changeupper_info *info)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment