提交 5514174f 编写于 作者: Y yuval.shaia@oracle.com 提交者: David S. Miller

net: phy: Make phy_ethtool_ksettings_get return void

Make return value void since function never return meaningfull value
Signed-off-by: NYuval Shaia <yuval.shaia@oracle.com>
Acked-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d980b8d1
...@@ -157,7 +157,9 @@ static int xge_get_link_ksettings(struct net_device *ndev, ...@@ -157,7 +157,9 @@ static int xge_get_link_ksettings(struct net_device *ndev,
if (!phydev) if (!phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_ksettings_get(phydev, cmd); phy_ethtool_ksettings_get(phydev, cmd);
return 0;
} }
static int xge_set_link_ksettings(struct net_device *ndev, static int xge_set_link_ksettings(struct net_device *ndev,
......
...@@ -131,13 +131,17 @@ static int xgene_get_link_ksettings(struct net_device *ndev, ...@@ -131,13 +131,17 @@ static int xgene_get_link_ksettings(struct net_device *ndev,
if (phydev == NULL) if (phydev == NULL)
return -ENODEV; return -ENODEV;
return phy_ethtool_ksettings_get(phydev, cmd); phy_ethtool_ksettings_get(phydev, cmd);
return 0;
} else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { } else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) {
if (pdata->mdio_driver) { if (pdata->mdio_driver) {
if (!phydev) if (!phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_ksettings_get(phydev, cmd); phy_ethtool_ksettings_get(phydev, cmd);
return 0;
} }
supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg | supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg |
......
...@@ -1836,7 +1836,9 @@ static int b44_get_link_ksettings(struct net_device *dev, ...@@ -1836,7 +1836,9 @@ static int b44_get_link_ksettings(struct net_device *dev,
if (bp->flags & B44_FLAG_EXTERNAL_PHY) { if (bp->flags & B44_FLAG_EXTERNAL_PHY) {
BUG_ON(!dev->phydev); BUG_ON(!dev->phydev);
return phy_ethtool_ksettings_get(dev->phydev, cmd); phy_ethtool_ksettings_get(dev->phydev, cmd);
return 0;
} }
supported = (SUPPORTED_Autoneg); supported = (SUPPORTED_Autoneg);
......
...@@ -1453,7 +1453,10 @@ static int bcm_enet_get_link_ksettings(struct net_device *dev, ...@@ -1453,7 +1453,10 @@ static int bcm_enet_get_link_ksettings(struct net_device *dev,
if (priv->has_phy) { if (priv->has_phy) {
if (!dev->phydev) if (!dev->phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_ksettings_get(dev->phydev, cmd);
phy_ethtool_ksettings_get(dev->phydev, cmd);
return 0;
} else { } else {
cmd->base.autoneg = 0; cmd->base.autoneg = 0;
cmd->base.speed = (priv->force_speed_100) ? cmd->base.speed = (priv->force_speed_100) ?
......
...@@ -477,7 +477,9 @@ static int bcmgenet_get_link_ksettings(struct net_device *dev, ...@@ -477,7 +477,9 @@ static int bcmgenet_get_link_ksettings(struct net_device *dev,
if (!priv->phydev) if (!priv->phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_ksettings_get(priv->phydev, cmd); phy_ethtool_ksettings_get(priv->phydev, cmd);
return 0;
} }
static int bcmgenet_set_link_ksettings(struct net_device *dev, static int bcmgenet_set_link_ksettings(struct net_device *dev,
......
...@@ -12097,7 +12097,9 @@ static int tg3_get_link_ksettings(struct net_device *dev, ...@@ -12097,7 +12097,9 @@ static int tg3_get_link_ksettings(struct net_device *dev,
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return -EAGAIN; return -EAGAIN;
phydev = mdiobus_get_phy(tp->mdio_bus, tp->phy_addr); phydev = mdiobus_get_phy(tp->mdio_bus, tp->phy_addr);
return phy_ethtool_ksettings_get(phydev, cmd); phy_ethtool_ksettings_get(phydev, cmd);
return 0;
} }
supported = (SUPPORTED_Autoneg); supported = (SUPPORTED_Autoneg);
......
...@@ -75,16 +75,14 @@ static char dpaa_stats_global[][ETH_GSTRING_LEN] = { ...@@ -75,16 +75,14 @@ static char dpaa_stats_global[][ETH_GSTRING_LEN] = {
static int dpaa_get_link_ksettings(struct net_device *net_dev, static int dpaa_get_link_ksettings(struct net_device *net_dev,
struct ethtool_link_ksettings *cmd) struct ethtool_link_ksettings *cmd)
{ {
int err;
if (!net_dev->phydev) { if (!net_dev->phydev) {
netdev_dbg(net_dev, "phy device not initialized\n"); netdev_dbg(net_dev, "phy device not initialized\n");
return 0; return 0;
} }
err = phy_ethtool_ksettings_get(net_dev->phydev, cmd); phy_ethtool_ksettings_get(net_dev->phydev, cmd);
return err; return 0;
} }
static int dpaa_set_link_ksettings(struct net_device *net_dev, static int dpaa_set_link_ksettings(struct net_device *net_dev,
......
...@@ -113,7 +113,9 @@ uec_get_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd) ...@@ -113,7 +113,9 @@ uec_get_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd)
if (!phydev) if (!phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_ksettings_get(phydev, cmd); phy_ethtool_ksettings_get(phydev, cmd);
return 0;
} }
static int static int
......
...@@ -150,7 +150,7 @@ static int hns_nic_get_link_ksettings(struct net_device *net_dev, ...@@ -150,7 +150,7 @@ static int hns_nic_get_link_ksettings(struct net_device *net_dev,
cmd->base.duplex = duplex; cmd->base.duplex = duplex;
if (net_dev->phydev) if (net_dev->phydev)
(void)phy_ethtool_ksettings_get(net_dev->phydev, cmd); phy_ethtool_ksettings_get(net_dev->phydev, cmd);
link_stat = hns_nic_get_link(net_dev); link_stat = hns_nic_get_link(net_dev);
if (!link_stat) { if (!link_stat) {
......
...@@ -1501,10 +1501,9 @@ mv643xx_eth_get_link_ksettings_phy(struct mv643xx_eth_private *mp, ...@@ -1501,10 +1501,9 @@ mv643xx_eth_get_link_ksettings_phy(struct mv643xx_eth_private *mp,
struct ethtool_link_ksettings *cmd) struct ethtool_link_ksettings *cmd)
{ {
struct net_device *dev = mp->dev; struct net_device *dev = mp->dev;
int err;
u32 supported, advertising; u32 supported, advertising;
err = phy_ethtool_ksettings_get(dev->phydev, cmd); phy_ethtool_ksettings_get(dev->phydev, cmd);
/* /*
* The MAC does not support 1000baseT_Half. * The MAC does not support 1000baseT_Half.
...@@ -1520,7 +1519,7 @@ mv643xx_eth_get_link_ksettings_phy(struct mv643xx_eth_private *mp, ...@@ -1520,7 +1519,7 @@ mv643xx_eth_get_link_ksettings_phy(struct mv643xx_eth_private *mp,
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
advertising); advertising);
return err; return 0;
} }
static int static int
......
...@@ -2056,7 +2056,9 @@ static int mtk_get_link_ksettings(struct net_device *ndev, ...@@ -2056,7 +2056,9 @@ static int mtk_get_link_ksettings(struct net_device *ndev,
if (unlikely(test_bit(MTK_RESETTING, &mac->hw->state))) if (unlikely(test_bit(MTK_RESETTING, &mac->hw->state)))
return -EBUSY; return -EBUSY;
return phy_ethtool_ksettings_get(ndev->phydev, cmd); phy_ethtool_ksettings_get(ndev->phydev, cmd);
return 0;
} }
static int mtk_set_link_ksettings(struct net_device *ndev, static int mtk_set_link_ksettings(struct net_device *ndev,
......
...@@ -1076,16 +1076,16 @@ static int ravb_get_link_ksettings(struct net_device *ndev, ...@@ -1076,16 +1076,16 @@ static int ravb_get_link_ksettings(struct net_device *ndev,
struct ethtool_link_ksettings *cmd) struct ethtool_link_ksettings *cmd)
{ {
struct ravb_private *priv = netdev_priv(ndev); struct ravb_private *priv = netdev_priv(ndev);
int error = -ENODEV;
unsigned long flags; unsigned long flags;
if (ndev->phydev) { if (!ndev->phydev)
spin_lock_irqsave(&priv->lock, flags); return -ENODEV;
error = phy_ethtool_ksettings_get(ndev->phydev, cmd);
spin_unlock_irqrestore(&priv->lock, flags);
}
return error; spin_lock_irqsave(&priv->lock, flags);
phy_ethtool_ksettings_get(ndev->phydev, cmd);
spin_unlock_irqrestore(&priv->lock, flags);
return 0;
} }
static int ravb_set_link_ksettings(struct net_device *ndev, static int ravb_set_link_ksettings(struct net_device *ndev,
......
...@@ -1915,16 +1915,15 @@ static int sh_eth_get_link_ksettings(struct net_device *ndev, ...@@ -1915,16 +1915,15 @@ static int sh_eth_get_link_ksettings(struct net_device *ndev,
{ {
struct sh_eth_private *mdp = netdev_priv(ndev); struct sh_eth_private *mdp = netdev_priv(ndev);
unsigned long flags; unsigned long flags;
int ret;
if (!ndev->phydev) if (!ndev->phydev)
return -ENODEV; return -ENODEV;
spin_lock_irqsave(&mdp->lock, flags); spin_lock_irqsave(&mdp->lock, flags);
ret = phy_ethtool_ksettings_get(ndev->phydev, cmd); phy_ethtool_ksettings_get(ndev->phydev, cmd);
spin_unlock_irqrestore(&mdp->lock, flags); spin_unlock_irqrestore(&mdp->lock, flags);
return ret; return 0;
} }
static int sh_eth_set_link_ksettings(struct net_device *ndev, static int sh_eth_set_link_ksettings(struct net_device *ndev,
......
...@@ -273,7 +273,6 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, ...@@ -273,7 +273,6 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev,
{ {
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
struct phy_device *phy = dev->phydev; struct phy_device *phy = dev->phydev;
int rc;
if (priv->hw->pcs & STMMAC_PCS_RGMII || if (priv->hw->pcs & STMMAC_PCS_RGMII ||
priv->hw->pcs & STMMAC_PCS_SGMII) { priv->hw->pcs & STMMAC_PCS_SGMII) {
...@@ -364,8 +363,8 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, ...@@ -364,8 +363,8 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev,
"link speed / duplex setting\n", dev->name); "link speed / duplex setting\n", dev->name);
return -EBUSY; return -EBUSY;
} }
rc = phy_ethtool_ksettings_get(phy, cmd); phy_ethtool_ksettings_get(phy, cmd);
return rc; return 0;
} }
static int static int
......
...@@ -2170,11 +2170,11 @@ static int cpsw_get_link_ksettings(struct net_device *ndev, ...@@ -2170,11 +2170,11 @@ static int cpsw_get_link_ksettings(struct net_device *ndev,
struct cpsw_common *cpsw = priv->cpsw; struct cpsw_common *cpsw = priv->cpsw;
int slave_no = cpsw_slave_index(cpsw, priv); int slave_no = cpsw_slave_index(cpsw, priv);
if (cpsw->slaves[slave_no].phy) if (!cpsw->slaves[slave_no].phy)
return phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy,
ecmd);
else
return -EOPNOTSUPP; return -EOPNOTSUPP;
phy_ethtool_ksettings_get(cpsw->slaves[slave_no].phy, ecmd);
return 0;
} }
static int cpsw_set_link_ksettings(struct net_device *ndev, static int cpsw_set_link_ksettings(struct net_device *ndev,
......
...@@ -1927,7 +1927,6 @@ static int keystone_get_link_ksettings(struct net_device *ndev, ...@@ -1927,7 +1927,6 @@ static int keystone_get_link_ksettings(struct net_device *ndev,
struct netcp_intf *netcp = netdev_priv(ndev); struct netcp_intf *netcp = netdev_priv(ndev);
struct phy_device *phy = ndev->phydev; struct phy_device *phy = ndev->phydev;
struct gbe_intf *gbe_intf; struct gbe_intf *gbe_intf;
int ret;
if (!phy) if (!phy)
return -EINVAL; return -EINVAL;
...@@ -1939,11 +1938,10 @@ static int keystone_get_link_ksettings(struct net_device *ndev, ...@@ -1939,11 +1938,10 @@ static int keystone_get_link_ksettings(struct net_device *ndev,
if (!gbe_intf->slave) if (!gbe_intf->slave)
return -EINVAL; return -EINVAL;
ret = phy_ethtool_ksettings_get(phy, cmd); phy_ethtool_ksettings_get(phy, cmd);
if (!ret) cmd->base.port = gbe_intf->slave->phy_port_t;
cmd->base.port = gbe_intf->slave->phy_port_t;
return ret; return 0;
} }
static int keystone_set_link_ksettings(struct net_device *ndev, static int keystone_set_link_ksettings(struct net_device *ndev,
......
...@@ -509,8 +509,8 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev, ...@@ -509,8 +509,8 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
} }
EXPORT_SYMBOL(phy_ethtool_ksettings_set); EXPORT_SYMBOL(phy_ethtool_ksettings_set);
int phy_ethtool_ksettings_get(struct phy_device *phydev, void phy_ethtool_ksettings_get(struct phy_device *phydev,
struct ethtool_link_ksettings *cmd) struct ethtool_link_ksettings *cmd)
{ {
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
phydev->supported); phydev->supported);
...@@ -532,8 +532,6 @@ int phy_ethtool_ksettings_get(struct phy_device *phydev, ...@@ -532,8 +532,6 @@ int phy_ethtool_ksettings_get(struct phy_device *phydev,
cmd->base.autoneg = phydev->autoneg; cmd->base.autoneg = phydev->autoneg;
cmd->base.eth_tp_mdix_ctrl = phydev->mdix_ctrl; cmd->base.eth_tp_mdix_ctrl = phydev->mdix_ctrl;
cmd->base.eth_tp_mdix = phydev->mdix; cmd->base.eth_tp_mdix = phydev->mdix;
return 0;
} }
EXPORT_SYMBOL(phy_ethtool_ksettings_get); EXPORT_SYMBOL(phy_ethtool_ksettings_get);
...@@ -1449,7 +1447,9 @@ int phy_ethtool_get_link_ksettings(struct net_device *ndev, ...@@ -1449,7 +1447,9 @@ int phy_ethtool_get_link_ksettings(struct net_device *ndev,
if (!phydev) if (!phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_ksettings_get(phydev, cmd); phy_ethtool_ksettings_get(phydev, cmd);
return 0;
} }
EXPORT_SYMBOL(phy_ethtool_get_link_ksettings); EXPORT_SYMBOL(phy_ethtool_get_link_ksettings);
......
...@@ -1490,7 +1490,7 @@ static int lan78xx_get_link_ksettings(struct net_device *net, ...@@ -1490,7 +1490,7 @@ static int lan78xx_get_link_ksettings(struct net_device *net,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = phy_ethtool_ksettings_get(phydev, cmd); phy_ethtool_ksettings_get(phydev, cmd);
usb_autopm_put_interface(dev->intf); usb_autopm_put_interface(dev->intf);
......
...@@ -179,7 +179,10 @@ static int xlr_get_link_ksettings(struct net_device *ndev, ...@@ -179,7 +179,10 @@ static int xlr_get_link_ksettings(struct net_device *ndev,
if (!phydev) if (!phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_ksettings_get(phydev, ecmd);
phy_ethtool_ksettings_get(phydev, ecmd);
return 0;
} }
static int xlr_set_link_ksettings(struct net_device *ndev, static int xlr_set_link_ksettings(struct net_device *ndev,
......
...@@ -872,8 +872,8 @@ void phy_start_machine(struct phy_device *phydev); ...@@ -872,8 +872,8 @@ void phy_start_machine(struct phy_device *phydev);
void phy_stop_machine(struct phy_device *phydev); void phy_stop_machine(struct phy_device *phydev);
void phy_trigger_machine(struct phy_device *phydev, bool sync); void phy_trigger_machine(struct phy_device *phydev, bool sync);
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
int phy_ethtool_ksettings_get(struct phy_device *phydev, void phy_ethtool_ksettings_get(struct phy_device *phydev,
struct ethtool_link_ksettings *cmd); struct ethtool_link_ksettings *cmd);
int phy_ethtool_ksettings_set(struct phy_device *phydev, int phy_ethtool_ksettings_set(struct phy_device *phydev,
const struct ethtool_link_ksettings *cmd); const struct ethtool_link_ksettings *cmd);
int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
......
...@@ -387,12 +387,13 @@ dsa_slave_get_link_ksettings(struct net_device *dev, ...@@ -387,12 +387,13 @@ dsa_slave_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *cmd) struct ethtool_link_ksettings *cmd)
{ {
struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_slave_priv *p = netdev_priv(dev);
int err = -EOPNOTSUPP;
if (p->phy != NULL) if (!p->phy)
err = phy_ethtool_ksettings_get(p->phy, cmd); return -EOPNOTSUPP;
return err; phy_ethtool_ksettings_get(p->phy, cmd);
return 0;
} }
static int static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册