net: dsa: return -ENODEV is there is no slave PHY
Instead of returning -EOPNOTSUPP when a slave device has no PHY, directly return -ENODEV as ethtool and phylib do. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f6fc5b494d
commit
f4344e0a48
|
@ -266,10 +266,10 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||||
{
|
{
|
||||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||||
|
|
||||||
if (p->phy != NULL)
|
if (!p->phy)
|
||||||
return phy_mii_ioctl(p->phy, ifr, cmd);
|
return -ENODEV;
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return phy_mii_ioctl(p->phy, ifr, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dsa_slave_port_attr_set(struct net_device *dev,
|
static int dsa_slave_port_attr_set(struct net_device *dev,
|
||||||
|
@ -429,7 +429,7 @@ dsa_slave_get_link_ksettings(struct net_device *dev,
|
||||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||||
|
|
||||||
if (!p->phy)
|
if (!p->phy)
|
||||||
return -EOPNOTSUPP;
|
return -ENODEV;
|
||||||
|
|
||||||
phy_ethtool_ksettings_get(p->phy, cmd);
|
phy_ethtool_ksettings_get(p->phy, cmd);
|
||||||
|
|
||||||
|
@ -442,10 +442,10 @@ dsa_slave_set_link_ksettings(struct net_device *dev,
|
||||||
{
|
{
|
||||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||||
|
|
||||||
if (p->phy != NULL)
|
if (!p->phy)
|
||||||
return phy_ethtool_ksettings_set(p->phy, cmd);
|
return -ENODEV;
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return phy_ethtool_ksettings_set(p->phy, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dsa_slave_get_drvinfo(struct net_device *dev,
|
static void dsa_slave_get_drvinfo(struct net_device *dev,
|
||||||
|
@ -481,22 +481,22 @@ static int dsa_slave_nway_reset(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||||
|
|
||||||
if (p->phy != NULL)
|
if (!p->phy)
|
||||||
return genphy_restart_aneg(p->phy);
|
return -ENODEV;
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return genphy_restart_aneg(p->phy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 dsa_slave_get_link(struct net_device *dev)
|
static u32 dsa_slave_get_link(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||||
|
|
||||||
if (p->phy != NULL) {
|
if (!p->phy)
|
||||||
genphy_update_link(p->phy);
|
return -ENODEV;
|
||||||
return p->phy->link;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
genphy_update_link(p->phy);
|
||||||
|
|
||||||
|
return p->phy->link;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dsa_slave_get_eeprom_len(struct net_device *dev)
|
static int dsa_slave_get_eeprom_len(struct net_device *dev)
|
||||||
|
|
Loading…
Reference in New Issue