net: ethernet: marvell: mvneta: use new api ethtool_{get|set}_link_ksettings
authorPhilippe Reynes <tremyfr@gmail.com>
Sat, 30 Jul 2016 15:42:12 +0000 (17:42 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Aug 2016 22:42:21 +0000 (15:42 -0700)
The ethtool api {get|set}_settings is deprecated.
We move the mvneta driver to new api {get|set}_link_ksettings.

We use the generic function phy_ethtool_get_link_ksettings,
and update old mvneta_ethtool_set_settings to the new api.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvneta.c

index d2ccab738acbe50c9dfbf2eb32900da6e49645ac..8e4252dd9a9db7a406bda66321b2db4da631de5b 100644 (file)
@@ -3505,30 +3505,22 @@ static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
 /* Ethtool methods */
 
-/* Get settings (phy address, speed) for ethtools */
-int mvneta_ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+/* Set link ksettings (phy address, speed) for ethtools */
+int mvneta_ethtool_set_link_ksettings(struct net_device *ndev,
+                                     const struct ethtool_link_ksettings *cmd)
 {
-       if (!dev->phydev)
-               return -ENODEV;
-
-       return phy_ethtool_gset(dev->phydev, cmd);
-}
-
-/* Set settings (phy address, speed) for ethtools */
-int mvneta_ethtool_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-       struct mvneta_port *pp = netdev_priv(dev);
-       struct phy_device *phydev = dev->phydev;
+       struct mvneta_port *pp = netdev_priv(ndev);
+       struct phy_device *phydev = ndev->phydev;
 
        if (!phydev)
                return -ENODEV;
 
-       if ((cmd->autoneg == AUTONEG_ENABLE) != pp->use_inband_status) {
+       if ((cmd->base.autoneg == AUTONEG_ENABLE) != pp->use_inband_status) {
                u32 val;
 
-               mvneta_set_autoneg(pp, cmd->autoneg == AUTONEG_ENABLE);
+               mvneta_set_autoneg(pp, cmd->base.autoneg == AUTONEG_ENABLE);
 
-               if (cmd->autoneg == AUTONEG_DISABLE) {
+               if (cmd->base.autoneg == AUTONEG_DISABLE) {
                        val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
                        val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
                                 MVNETA_GMAC_CONFIG_GMII_SPEED |
@@ -3545,17 +3537,17 @@ int mvneta_ethtool_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                        mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
                }
 
-               pp->use_inband_status = (cmd->autoneg == AUTONEG_ENABLE);
+               pp->use_inband_status = (cmd->base.autoneg == AUTONEG_ENABLE);
                netdev_info(pp->dev, "autoneg status set to %i\n",
                            pp->use_inband_status);
 
-               if (netif_running(dev)) {
+               if (netif_running(ndev)) {
                        mvneta_port_down(pp);
                        mvneta_port_up(pp);
                }
        }
 
-       return phy_ethtool_sset(dev->phydev, cmd);
+       return phy_ethtool_ksettings_set(ndev->phydev, cmd);
 }
 
 /* Set interrupt coalescing for ethtools */
@@ -3819,8 +3811,6 @@ static const struct net_device_ops mvneta_netdev_ops = {
 
 const struct ethtool_ops mvneta_eth_tool_ops = {
        .get_link       = ethtool_op_get_link,
-       .get_settings   = mvneta_ethtool_get_settings,
-       .set_settings   = mvneta_ethtool_set_settings,
        .set_coalesce   = mvneta_ethtool_set_coalesce,
        .get_coalesce   = mvneta_ethtool_get_coalesce,
        .get_drvinfo    = mvneta_ethtool_get_drvinfo,
@@ -3833,6 +3823,8 @@ const struct ethtool_ops mvneta_eth_tool_ops = {
        .get_rxnfc      = mvneta_ethtool_get_rxnfc,
        .get_rxfh       = mvneta_ethtool_get_rxfh,
        .set_rxfh       = mvneta_ethtool_set_rxfh,
+       .get_link_ksettings = phy_ethtool_get_link_ksettings,
+       .set_link_ksettings = mvneta_ethtool_set_link_ksettings,
 };
 
 /* Initialize hw */