net: convert suitable drivers to use phy_do_ioctl_running
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 21 Jan 2020 21:09:33 +0000 (22:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jan 2020 09:49:30 +0000 (10:49 +0100)
Convert suitable drivers to use new helper phy_do_ioctl_running.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Timur Tabi <timur@kernel.org>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
19 files changed:
drivers/net/ethernet/allwinner/sun4i-emac.c
drivers/net/ethernet/amd/au1000_eth.c
drivers/net/ethernet/arc/emac_main.c
drivers/net/ethernet/broadcom/bgmac.c
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/dnet.c
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
drivers/net/ethernet/hisilicon/hisi_femac.c
drivers/net/ethernet/hisilicon/hns/hns_enet.c
drivers/net/ethernet/nxp/lpc_eth.c
drivers/net/ethernet/qualcomm/emac/emac.c
drivers/net/ethernet/renesas/sh_eth.c
drivers/net/ethernet/smsc/smsc911x.c
drivers/net/ethernet/smsc/smsc9420.c
drivers/net/ethernet/ti/cpmac.c
drivers/net/ethernet/toshiba/tc35815.c
drivers/net/ethernet/xilinx/ll_temac_main.c
drivers/net/usb/ax88172a.c
drivers/net/usb/lan78xx.c

index 5ea806423e4cbc60b32008f2453fb0e2e8ff585f..22cadfbeedfb8d5290129ce2ea76bb38fa7cc165 100644 (file)
@@ -207,19 +207,6 @@ static void emac_inblk_32bit(void __iomem *reg, void *data, int count)
        readsl(reg, data, round_up(count, 4) / 4);
 }
 
-static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       struct phy_device *phydev = dev->phydev;
-
-       if (!netif_running(dev))
-               return -EINVAL;
-
-       if (!phydev)
-               return -ENODEV;
-
-       return phy_mii_ioctl(phydev, rq, cmd);
-}
-
 /* ethtool ops */
 static void emac_get_drvinfo(struct net_device *dev,
                              struct ethtool_drvinfo *info)
@@ -791,7 +778,7 @@ static const struct net_device_ops emac_netdev_ops = {
        .ndo_start_xmit         = emac_start_xmit,
        .ndo_tx_timeout         = emac_timeout,
        .ndo_set_rx_mode        = emac_set_rx_mode,
-       .ndo_do_ioctl           = emac_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = emac_set_mac_address,
 #ifdef CONFIG_NET_POLL_CONTROLLER
index d832c9f4d306fe4dcfb2d8edbee8654493c131e6..255847e7fa5b82c66622e89d5f4e859b5c6a639e 100644 (file)
@@ -1053,23 +1053,12 @@ static void au1000_multicast_list(struct net_device *dev)
        writel(reg, &aup->mac->control);
 }
 
-static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       if (!netif_running(dev))
-               return -EINVAL;
-
-       if (!dev->phydev)
-               return -EINVAL; /* PHY not controllable */
-
-       return phy_mii_ioctl(dev->phydev, rq, cmd);
-}
-
 static const struct net_device_ops au1000_netdev_ops = {
        .ndo_open               = au1000_open,
        .ndo_stop               = au1000_close,
        .ndo_start_xmit         = au1000_tx,
        .ndo_set_rx_mode        = au1000_multicast_list,
-       .ndo_do_ioctl           = au1000_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_tx_timeout         = au1000_tx_timeout,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
index 6f2c867785fe4752b52404fb176fb26b7e81e50b..17bda4e8cc45a4c4f3b95bab4b4aabd8e6365bbc 100644 (file)
@@ -781,18 +781,6 @@ static int arc_emac_set_address(struct net_device *ndev, void *p)
        return 0;
 }
 
-static int arc_emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       if (!netif_running(dev))
-               return -EINVAL;
-
-       if (!dev->phydev)
-               return -ENODEV;
-
-       return phy_mii_ioctl(dev->phydev, rq, cmd);
-}
-
-
 /**
  * arc_emac_restart - Restart EMAC
  * @ndev:      Pointer to net_device structure.
@@ -857,7 +845,7 @@ static const struct net_device_ops arc_emac_netdev_ops = {
        .ndo_set_mac_address    = arc_emac_set_address,
        .ndo_get_stats          = arc_emac_stats,
        .ndo_set_rx_mode        = arc_emac_set_rx_mode,
-       .ndo_do_ioctl           = arc_emac_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = arc_emac_poll_controller,
 #endif
index 148734b166f04b1cfec014bbbbd8c1616df85752..1bb07a5d82c953cf4714c40ca72fc2e5238b59d9 100644 (file)
@@ -1248,14 +1248,6 @@ static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
        return 0;
 }
 
-static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
-{
-       if (!netif_running(net_dev))
-               return -EINVAL;
-
-       return phy_mii_ioctl(net_dev->phydev, ifr, cmd);
-}
-
 static const struct net_device_ops bgmac_netdev_ops = {
        .ndo_open               = bgmac_open,
        .ndo_stop               = bgmac_stop,
@@ -1263,7 +1255,7 @@ static const struct net_device_ops bgmac_netdev_ops = {
        .ndo_set_rx_mode        = bgmac_set_rx_mode,
        .ndo_set_mac_address    = bgmac_set_mac_address,
        .ndo_validate_addr      = eth_validate_addr,
-       .ndo_do_ioctl           = bgmac_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
 };
 
 /**************************************************
index 3ee7917e3fc0c96ce12d04129a24ceb0a8986beb..013959285a61972d16d0ff1a8ce200a8e81ed2a7 100644 (file)
@@ -1225,18 +1225,6 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
        }
 }
 
-/* ioctl handle special commands that are not present in ethtool. */
-static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       if (!netif_running(dev))
-               return -EINVAL;
-
-       if (!dev->phydev)
-               return -ENODEV;
-
-       return phy_mii_ioctl(dev->phydev, rq, cmd);
-}
-
 static struct enet_cb *bcmgenet_get_txcb(struct bcmgenet_priv *priv,
                                         struct bcmgenet_tx_ring *ring)
 {
@@ -3222,7 +3210,7 @@ static const struct net_device_ops bcmgenet_netdev_ops = {
        .ndo_tx_timeout         = bcmgenet_timeout,
        .ndo_set_rx_mode        = bcmgenet_set_rx_mode,
        .ndo_set_mac_address    = bcmgenet_set_mac_addr,
-       .ndo_do_ioctl           = bcmgenet_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_set_features       = bcmgenet_set_features,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = bcmgenet_poll_controller,
index e24979010969915ebb46c70563bfd97be025a7d2..5f8fa1145db697c0c33fbb3ab683e9c9d74d0ef1 100644 (file)
@@ -725,19 +725,6 @@ static struct net_device_stats *dnet_get_stats(struct net_device *dev)
        return nstat;
 }
 
-static int dnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       struct phy_device *phydev = dev->phydev;
-
-       if (!netif_running(dev))
-               return -EINVAL;
-
-       if (!phydev)
-               return -ENODEV;
-
-       return phy_mii_ioctl(phydev, rq, cmd);
-}
-
 static void dnet_get_drvinfo(struct net_device *dev,
                             struct ethtool_drvinfo *info)
 {
@@ -759,7 +746,7 @@ static const struct net_device_ops dnet_netdev_ops = {
        .ndo_stop               = dnet_close,
        .ndo_get_stats          = dnet_get_stats,
        .ndo_start_xmit         = dnet_start_xmit,
-       .ndo_do_ioctl           = dnet_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
index 80903cd584689802bf79d20f73423c98031db773..add61fed33ee8ae0d206849676b4ad87e2b85c16 100644 (file)
@@ -882,14 +882,6 @@ static const struct ethtool_ops fs_ethtool_ops = {
        .set_tunable = fs_set_tunable,
 };
 
-static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       if (!netif_running(dev))
-               return -EINVAL;
-
-       return phy_mii_ioctl(dev->phydev, rq, cmd);
-}
-
 extern int fs_mii_connect(struct net_device *dev);
 extern void fs_mii_disconnect(struct net_device *dev);
 
@@ -907,7 +899,7 @@ static const struct net_device_ops fs_enet_netdev_ops = {
        .ndo_start_xmit         = fs_enet_start_xmit,
        .ndo_tx_timeout         = fs_timeout,
        .ndo_set_rx_mode        = fs_set_multicast_list,
-       .ndo_do_ioctl           = fs_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
index 90ab7ade44c44929e961fbb18a794585f12ffb30..57c3bc4f7089580586f53d559f584c10087c3179 100644 (file)
@@ -675,18 +675,6 @@ static void hisi_femac_net_set_rx_mode(struct net_device *dev)
        }
 }
 
-static int hisi_femac_net_ioctl(struct net_device *dev,
-                               struct ifreq *ifreq, int cmd)
-{
-       if (!netif_running(dev))
-               return -EINVAL;
-
-       if (!dev->phydev)
-               return -EINVAL;
-
-       return phy_mii_ioctl(dev->phydev, ifreq, cmd);
-}
-
 static const struct ethtool_ops hisi_femac_ethtools_ops = {
        .get_link               = ethtool_op_get_link,
        .get_link_ksettings     = phy_ethtool_get_link_ksettings,
@@ -697,7 +685,7 @@ static const struct net_device_ops hisi_femac_netdev_ops = {
        .ndo_open               = hisi_femac_net_open,
        .ndo_stop               = hisi_femac_net_close,
        .ndo_start_xmit         = hisi_femac_net_xmit,
-       .ndo_do_ioctl           = hisi_femac_net_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_set_mac_address    = hisi_femac_set_mac_address,
        .ndo_set_rx_mode        = hisi_femac_net_set_rx_mode,
 };
index 2fbb476584bc749dc4a441ab81e899fd67ff2738..c117074c16e3d3396e0606f10ca9db57b6b0e270 100644 (file)
@@ -1497,20 +1497,6 @@ static void hns_nic_net_timeout(struct net_device *ndev, unsigned int txqueue)
        }
 }
 
-static int hns_nic_do_ioctl(struct net_device *netdev, struct ifreq *ifr,
-                           int cmd)
-{
-       struct phy_device *phy_dev = netdev->phydev;
-
-       if (!netif_running(netdev))
-               return -EINVAL;
-
-       if (!phy_dev)
-               return -ENOTSUPP;
-
-       return phy_mii_ioctl(phy_dev, ifr, cmd);
-}
-
 static netdev_tx_t hns_nic_net_xmit(struct sk_buff *skb,
                                    struct net_device *ndev)
 {
@@ -1958,7 +1944,7 @@ static const struct net_device_ops hns_nic_netdev_ops = {
        .ndo_tx_timeout = hns_nic_net_timeout,
        .ndo_set_mac_address = hns_nic_net_set_mac_address,
        .ndo_change_mtu = hns_nic_change_mtu,
-       .ndo_do_ioctl = hns_nic_do_ioctl,
+       .ndo_do_ioctl = phy_do_ioctl_running,
        .ndo_set_features = hns_nic_set_features,
        .ndo_fix_features = hns_nic_fix_features,
        .ndo_get_stats64 = hns_nic_get_stats64,
index 656169214cdb4f66d4543ac9aaf0020605ab08b1..d20cf03a3ea0c365b756eb4b58161990de446d1a 100644 (file)
@@ -1149,19 +1149,6 @@ static void lpc_eth_set_multicast_list(struct net_device *ndev)
        spin_unlock_irqrestore(&pldat->lock, flags);
 }
 
-static int lpc_eth_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
-{
-       struct phy_device *phydev = ndev->phydev;
-
-       if (!netif_running(ndev))
-               return -EINVAL;
-
-       if (!phydev)
-               return -ENODEV;
-
-       return phy_mii_ioctl(phydev, req, cmd);
-}
-
 static int lpc_eth_open(struct net_device *ndev)
 {
        struct netdata_local *pldat = netdev_priv(ndev);
@@ -1229,7 +1216,7 @@ static const struct net_device_ops lpc_netdev_ops = {
        .ndo_stop               = lpc_eth_close,
        .ndo_start_xmit         = lpc_eth_hard_start_xmit,
        .ndo_set_rx_mode        = lpc_eth_set_multicast_list,
-       .ndo_do_ioctl           = lpc_eth_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_set_mac_address    = lpc_set_mac_address,
        .ndo_validate_addr      = eth_validate_addr,
 };
index 522fad4cb2cd8fe15bbd1c609689f6750d3f1b7c..18b0c7a2d6dcb0b205f30af89a8186a867a7d233 100644 (file)
@@ -289,18 +289,6 @@ static void emac_tx_timeout(struct net_device *netdev, unsigned int txqueue)
        schedule_work(&adpt->work_thread);
 }
 
-/* IOCTL support for the interface */
-static int emac_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
-{
-       if (!netif_running(netdev))
-               return -EINVAL;
-
-       if (!netdev->phydev)
-               return -ENODEV;
-
-       return phy_mii_ioctl(netdev->phydev, ifr, cmd);
-}
-
 /**
  * emac_update_hw_stats - read the EMAC stat registers
  *
@@ -387,7 +375,7 @@ static const struct net_device_ops emac_netdev_ops = {
        .ndo_start_xmit         = emac_start_xmit,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_change_mtu         = emac_change_mtu,
-       .ndo_do_ioctl           = emac_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_tx_timeout         = emac_tx_timeout,
        .ndo_get_stats64        = emac_get_stats64,
        .ndo_set_features       = emac_set_features,
index c922d7a553f2b55ac4715e5d3d447edecac97811..58ca126518a22e3e1748968f05506bdd7e87188a 100644 (file)
@@ -2647,20 +2647,6 @@ static int sh_eth_close(struct net_device *ndev)
        return 0;
 }
 
-/* ioctl to device function */
-static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
-{
-       struct phy_device *phydev = ndev->phydev;
-
-       if (!netif_running(ndev))
-               return -EINVAL;
-
-       if (!phydev)
-               return -ENODEV;
-
-       return phy_mii_ioctl(phydev, rq, cmd);
-}
-
 static int sh_eth_change_mtu(struct net_device *ndev, int new_mtu)
 {
        if (netif_running(ndev))
@@ -3159,7 +3145,7 @@ static const struct net_device_ops sh_eth_netdev_ops = {
        .ndo_get_stats          = sh_eth_get_stats,
        .ndo_set_rx_mode        = sh_eth_set_rx_mode,
        .ndo_tx_timeout         = sh_eth_tx_timeout,
-       .ndo_do_ioctl           = sh_eth_do_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_change_mtu         = sh_eth_change_mtu,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
@@ -3175,7 +3161,7 @@ static const struct net_device_ops sh_eth_netdev_ops_tsu = {
        .ndo_vlan_rx_add_vid    = sh_eth_vlan_rx_add_vid,
        .ndo_vlan_rx_kill_vid   = sh_eth_vlan_rx_kill_vid,
        .ndo_tx_timeout         = sh_eth_tx_timeout,
-       .ndo_do_ioctl           = sh_eth_do_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_change_mtu         = sh_eth_change_mtu,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
index 38068fc341410f1237eec25b61a9d9542d7dc1e9..7dc2154ccdad79092d2387f342c7d1c15cb09a0d 100644 (file)
@@ -1943,15 +1943,6 @@ static int smsc911x_set_mac_address(struct net_device *dev, void *p)
        return 0;
 }
 
-/* Standard ioctls for mii-tool */
-static int smsc911x_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-       if (!netif_running(dev) || !dev->phydev)
-               return -EINVAL;
-
-       return phy_mii_ioctl(dev->phydev, ifr, cmd);
-}
-
 static void smsc911x_ethtool_getdrvinfo(struct net_device *dev,
                                        struct ethtool_drvinfo *info)
 {
@@ -2151,7 +2142,7 @@ static const struct net_device_ops smsc911x_netdev_ops = {
        .ndo_start_xmit         = smsc911x_hard_start_xmit,
        .ndo_get_stats          = smsc911x_get_stats,
        .ndo_set_rx_mode        = smsc911x_set_multicast_list,
-       .ndo_do_ioctl           = smsc911x_do_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = smsc911x_set_mac_address,
 #ifdef CONFIG_NET_POLL_CONTROLLER
index a6962a41c3d25c34599853b52204fa24a549a9f0..7312e522c0226ed608fb4a554d0a3822a106a95c 100644 (file)
@@ -210,15 +210,6 @@ static int smsc9420_eeprom_reload(struct smsc9420_pdata *pd)
        return -EIO;
 }
 
-/* Standard ioctls for mii-tool */
-static int smsc9420_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-       if (!netif_running(dev) || !dev->phydev)
-               return -EINVAL;
-
-       return phy_mii_ioctl(dev->phydev, ifr, cmd);
-}
-
 static void smsc9420_ethtool_get_drvinfo(struct net_device *netdev,
                                         struct ethtool_drvinfo *drvinfo)
 {
@@ -1504,7 +1495,7 @@ static const struct net_device_ops smsc9420_netdev_ops = {
        .ndo_start_xmit         = smsc9420_hard_start_xmit,
        .ndo_get_stats          = smsc9420_get_stats,
        .ndo_set_rx_mode        = smsc9420_set_multicast_list,
-       .ndo_do_ioctl           = smsc9420_do_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
index 5e1b8292cd3f4e4909529b0e1fe3e72604e272e8..a530afe3ce12c536967c21a0d3040f5f537386b7 100644 (file)
@@ -816,16 +816,6 @@ static void cpmac_tx_timeout(struct net_device *dev, unsigned int txqueue)
        netif_tx_wake_all_queues(priv->dev);
 }
 
-static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-       if (!(netif_running(dev)))
-               return -EINVAL;
-       if (!dev->phydev)
-               return -EINVAL;
-
-       return phy_mii_ioctl(dev->phydev, ifr, cmd);
-}
-
 static void cpmac_get_ringparam(struct net_device *dev,
                                                struct ethtool_ringparam *ring)
 {
@@ -1054,7 +1044,7 @@ static const struct net_device_ops cpmac_netdev_ops = {
        .ndo_start_xmit         = cpmac_start_xmit,
        .ndo_tx_timeout         = cpmac_tx_timeout,
        .ndo_set_rx_mode        = cpmac_set_multicast_list,
-       .ndo_do_ioctl           = cpmac_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
 };
index 708de826200ef7139fbaebd4d0ba6cc672f2a454..3fd43d30b20d961f77579bacbb63316a32261ec4 100644 (file)
@@ -484,7 +484,6 @@ static int  tc35815_close(struct net_device *dev);
 static struct  net_device_stats *tc35815_get_stats(struct net_device *dev);
 static void    tc35815_set_multicast_list(struct net_device *dev);
 static void    tc35815_tx_timeout(struct net_device *dev, unsigned int txqueue);
-static int     tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void    tc35815_poll_controller(struct net_device *dev);
 #endif
@@ -751,7 +750,7 @@ static const struct net_device_ops tc35815_netdev_ops = {
        .ndo_get_stats          = tc35815_get_stats,
        .ndo_set_rx_mode        = tc35815_set_multicast_list,
        .ndo_tx_timeout         = tc35815_tx_timeout,
-       .ndo_do_ioctl           = tc35815_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -2009,15 +2008,6 @@ static const struct ethtool_ops tc35815_ethtool_ops = {
        .set_link_ksettings = phy_ethtool_set_link_ksettings,
 };
 
-static int tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       if (!netif_running(dev))
-               return -EINVAL;
-       if (!dev->phydev)
-               return -ENODEV;
-       return phy_mii_ioctl(dev->phydev, rq, cmd);
-}
-
 static void tc35815_chip_reset(struct net_device *dev)
 {
        struct tc35815_regs __iomem *tr =
index 21c1b4322ea78941d0ee58801dbe62f3442f1acc..f5bbb19d62d0ef92339692eca2a875b08cd7f693 100644 (file)
@@ -1080,17 +1080,6 @@ temac_poll_controller(struct net_device *ndev)
 }
 #endif
 
-static int temac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
-{
-       if (!netif_running(ndev))
-               return -EINVAL;
-
-       if (!ndev->phydev)
-               return -EINVAL;
-
-       return phy_mii_ioctl(ndev->phydev, rq, cmd);
-}
-
 static const struct net_device_ops temac_netdev_ops = {
        .ndo_open = temac_open,
        .ndo_stop = temac_stop,
@@ -1098,7 +1087,7 @@ static const struct net_device_ops temac_netdev_ops = {
        .ndo_set_rx_mode = temac_set_multicast_list,
        .ndo_set_mac_address = temac_set_mac_address,
        .ndo_validate_addr = eth_validate_addr,
-       .ndo_do_ioctl = temac_ioctl,
+       .ndo_do_ioctl = phy_do_ioctl_running,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller = temac_poll_controller,
 #endif
index af3994e0853b54473dd5f0de62f3663b28ab70ec..4e514f5d7c6c7c2a2af2cbb3e214c902bc8c7302 100644 (file)
@@ -39,17 +39,6 @@ static int asix_mdio_bus_write(struct mii_bus *bus, int phy_id, int regnum,
        return 0;
 }
 
-static int ax88172a_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
-{
-       if (!netif_running(net))
-               return -EINVAL;
-
-       if (!net->phydev)
-               return -ENODEV;
-
-       return phy_mii_ioctl(net->phydev, rq, cmd);
-}
-
 /* set MAC link settings according to information from phylib */
 static void ax88172a_adjust_link(struct net_device *netdev)
 {
@@ -134,7 +123,7 @@ static const struct net_device_ops ax88172a_netdev_ops = {
        .ndo_get_stats64        = usbnet_get_stats64,
        .ndo_set_mac_address    = asix_set_mac_address,
        .ndo_validate_addr      = eth_validate_addr,
-       .ndo_do_ioctl           = ax88172a_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_set_rx_mode        = asix_set_multicast,
 };
 
index c391f2521ba1a2bef14be40cec5c6e8791693652..d2d61f082710d6db4e5a6bc323329cb285b58425 100644 (file)
@@ -1663,14 +1663,6 @@ static const struct ethtool_ops lan78xx_ethtool_ops = {
        .get_regs       = lan78xx_get_regs,
 };
 
-static int lan78xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
-{
-       if (!netif_running(netdev))
-               return -EINVAL;
-
-       return phy_mii_ioctl(netdev->phydev, rq, cmd);
-}
-
 static void lan78xx_init_mac_address(struct lan78xx_net *dev)
 {
        u32 addr_lo, addr_hi;
@@ -3676,7 +3668,7 @@ static const struct net_device_ops lan78xx_netdev_ops = {
        .ndo_change_mtu         = lan78xx_change_mtu,
        .ndo_set_mac_address    = lan78xx_set_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
-       .ndo_do_ioctl           = lan78xx_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl_running,
        .ndo_set_rx_mode        = lan78xx_set_multicast,
        .ndo_set_features       = lan78xx_set_features,
        .ndo_vlan_rx_add_vid    = lan78xx_vlan_rx_add_vid,