Commit 54fecff3 authored by Doug Berger's avatar Doug Berger Committed by David S. Miller

net: bcmgenet: return EOPNOTSUPP for unknown ioctl commands

This commit changes the ioctl handling behavior to return the
EOPNOTSUPP error code instead of the EINVAL error code when an
unknown ioctl command value is detected.

It also removes some redundant parsing of the ioctl command value
and allows the SIOCSHWTSTAMP value to be handled.
Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c4d453d2
...@@ -1062,27 +1062,14 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv, ...@@ -1062,27 +1062,14 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct bcmgenet_priv *priv = netdev_priv(dev); struct bcmgenet_priv *priv = netdev_priv(dev);
int val = 0;
if (!netif_running(dev)) if (!netif_running(dev))
return -EINVAL; return -EINVAL;
switch (cmd) { if (!priv->phydev)
case SIOCGMIIPHY: return -ENODEV;
case SIOCGMIIREG:
case SIOCSMIIREG:
if (!priv->phydev)
val = -ENODEV;
else
val = phy_mii_ioctl(priv->phydev, rq, cmd);
break;
default:
val = -EINVAL;
break;
}
return val; return phy_mii_ioctl(priv->phydev, rq, cmd);
} }
static struct enet_cb *bcmgenet_get_txcb(struct bcmgenet_priv *priv, static struct enet_cb *bcmgenet_get_txcb(struct bcmgenet_priv *priv,
......
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