]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: convert suitable network drivers to use phy_do_ioctl
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 20 Jan 2020 21:18:37 +0000 (22:18 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jan 2020 09:50:41 +0000 (10:50 +0100)
Convert suitable network drivers to use phy_do_ioctl.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/agere/et131x.c
drivers/net/ethernet/atheros/ag71xx.c
drivers/net/ethernet/faraday/ftgmac100.c
drivers/net/ethernet/freescale/fec_mpc52xx.c
drivers/net/ethernet/rdc/r6040.c

index 3c51d8c502ed81fc4ff5626d096240a0c54b3819..cb6a761d5c116f25c848ed2b2c96c46ea85722b4 100644 (file)
@@ -3651,15 +3651,6 @@ static int et131x_close(struct net_device *netdev)
        return del_timer_sync(&adapter->error_timer);
 }
 
-static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf,
-                       int cmd)
-{
-       if (!netdev->phydev)
-               return -EINVAL;
-
-       return phy_mii_ioctl(netdev->phydev, reqbuf, cmd);
-}
-
 /* et131x_set_packet_filter - Configures the Rx Packet filtering */
 static int et131x_set_packet_filter(struct et131x_adapter *adapter)
 {
@@ -3899,7 +3890,7 @@ static const struct net_device_ops et131x_netdev_ops = {
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_get_stats          = et131x_stats,
-       .ndo_do_ioctl           = et131x_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl,
 };
 
 static int et131x_pci_setup(struct pci_dev *pdev,
index 88e4e1500a8eef9c38bc6143acb6c0b5e17d2316..5ce2df482d8c5ea1e3229303e39152e213d6f40c 100644 (file)
@@ -1394,14 +1394,6 @@ err_drop:
        return NETDEV_TX_OK;
 }
 
-static int ag71xx_do_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
-{
-       if (!ndev->phydev)
-               return -EINVAL;
-
-       return phy_mii_ioctl(ndev->phydev, ifr, cmd);
-}
-
 static void ag71xx_oom_timer_handler(struct timer_list *t)
 {
        struct ag71xx *ag = from_timer(ag, t, oom_timer);
@@ -1618,7 +1610,7 @@ static const struct net_device_ops ag71xx_netdev_ops = {
        .ndo_open               = ag71xx_open,
        .ndo_stop               = ag71xx_stop,
        .ndo_start_xmit         = ag71xx_hard_start_xmit,
-       .ndo_do_ioctl           = ag71xx_do_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl,
        .ndo_tx_timeout         = ag71xx_tx_timeout,
        .ndo_change_mtu         = ag71xx_change_mtu,
        .ndo_set_mac_address    = eth_mac_addr,
index 48b3b72fe02e49349cfdfc63f6298cba292a67f8..4572797f00d7899acab31a658cf792f06af608f2 100644 (file)
@@ -1536,15 +1536,6 @@ static int ftgmac100_stop(struct net_device *netdev)
        return 0;
 }
 
-/* optional */
-static int ftgmac100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
-{
-       if (!netdev->phydev)
-               return -ENXIO;
-
-       return phy_mii_ioctl(netdev->phydev, ifr, cmd);
-}
-
 static void ftgmac100_tx_timeout(struct net_device *netdev, unsigned int txqueue)
 {
        struct ftgmac100 *priv = netdev_priv(netdev);
@@ -1597,7 +1588,7 @@ static const struct net_device_ops ftgmac100_netdev_ops = {
        .ndo_start_xmit         = ftgmac100_hard_start_xmit,
        .ndo_set_mac_address    = ftgmac100_set_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
-       .ndo_do_ioctl           = ftgmac100_do_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl,
        .ndo_tx_timeout         = ftgmac100_tx_timeout,
        .ndo_set_rx_mode        = ftgmac100_set_rx_mode,
        .ndo_set_features       = ftgmac100_set_features,
index de5278485062750c1c177f55f0b8821409ec2fca..7a3f066e611da8192b4d27366a11f1d086a6d5af 100644 (file)
@@ -785,16 +785,6 @@ static const struct ethtool_ops mpc52xx_fec_ethtool_ops = {
 };
 
 
-static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       struct phy_device *phydev = dev->phydev;
-
-       if (!phydev)
-               return -ENOTSUPP;
-
-       return phy_mii_ioctl(phydev, rq, cmd);
-}
-
 static const struct net_device_ops mpc52xx_fec_netdev_ops = {
        .ndo_open = mpc52xx_fec_open,
        .ndo_stop = mpc52xx_fec_close,
@@ -802,7 +792,7 @@ static const struct net_device_ops mpc52xx_fec_netdev_ops = {
        .ndo_set_rx_mode = mpc52xx_fec_set_multicast_list,
        .ndo_set_mac_address = mpc52xx_fec_set_mac_address,
        .ndo_validate_addr = eth_validate_addr,
-       .ndo_do_ioctl = mpc52xx_fec_ioctl,
+       .ndo_do_ioctl = phy_do_ioctl,
        .ndo_tx_timeout = mpc52xx_fec_tx_timeout,
        .ndo_get_stats = mpc52xx_fec_get_stats,
 #ifdef CONFIG_NET_POLL_CONTROLLER
index c23cb61bbd30686451f939482771818ba83bb563..f5ecc410ff8558fdcadb4a88fe8bd28ad271c744 100644 (file)
@@ -498,14 +498,6 @@ static int r6040_close(struct net_device *dev)
        return 0;
 }
 
-static int r6040_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-       if (!dev->phydev)
-               return -EINVAL;
-
-       return phy_mii_ioctl(dev->phydev, rq, cmd);
-}
-
 static int r6040_rx(struct net_device *dev, int limit)
 {
        struct r6040_private *priv = netdev_priv(dev);
@@ -957,7 +949,7 @@ static const struct net_device_ops r6040_netdev_ops = {
        .ndo_set_rx_mode        = r6040_multicast_list,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = eth_mac_addr,
-       .ndo_do_ioctl           = r6040_ioctl,
+       .ndo_do_ioctl           = phy_do_ioctl,
        .ndo_tx_timeout         = r6040_tx_timeout,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = r6040_poll_controller,