mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
net: dsa: PHY device is mandatory for EEE
The port's PHY and MAC are both implied in EEE. The current code does not call the PHY operations if the related device is NULL. Change that by returning -ENODEV if there's no PHY device attached to the interface. 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
13e6be2d22
commit
7b9cc73843
@ -648,6 +648,10 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)
|
|||||||
struct dsa_switch *ds = p->dp->ds;
|
struct dsa_switch *ds = p->dp->ds;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* Port's PHY and MAC both need to be EEE capable */
|
||||||
|
if (!p->phy)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
if (!ds->ops->set_eee)
|
if (!ds->ops->set_eee)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
@ -655,10 +659,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (p->phy)
|
return phy_ethtool_set_eee(p->phy, e);
|
||||||
ret = phy_ethtool_set_eee(p->phy, e);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)
|
static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)
|
||||||
@ -667,6 +668,10 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)
|
|||||||
struct dsa_switch *ds = p->dp->ds;
|
struct dsa_switch *ds = p->dp->ds;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* Port's PHY and MAC both need to be EEE capable */
|
||||||
|
if (!p->phy)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
if (!ds->ops->get_eee)
|
if (!ds->ops->get_eee)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
@ -674,10 +679,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (p->phy)
|
return phy_ethtool_get_eee(p->phy, e);
|
||||||
ret = phy_ethtool_get_eee(p->phy, e);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||||
|
Loading…
Reference in New Issue
Block a user