Skip to content

Commit fd786fb

Browse files
hkallweitdavem330
authored andcommitted
net: convert suitable drivers to use phy_do_ioctl_running
Convert suitable drivers to use new helper phy_do_ioctl_running. Signed-off-by: Heiner Kallweit <[email protected]> Acked-by: Timur Tabi <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 954b3c4 commit fd786fb

File tree

19 files changed

+20
-230
lines changed

19 files changed

+20
-230
lines changed

drivers/net/ethernet/allwinner/sun4i-emac.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,6 @@ static void emac_inblk_32bit(void __iomem *reg, void *data, int count)
207207
readsl(reg, data, round_up(count, 4) / 4);
208208
}
209209

210-
static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
211-
{
212-
struct phy_device *phydev = dev->phydev;
213-
214-
if (!netif_running(dev))
215-
return -EINVAL;
216-
217-
if (!phydev)
218-
return -ENODEV;
219-
220-
return phy_mii_ioctl(phydev, rq, cmd);
221-
}
222-
223210
/* ethtool ops */
224211
static void emac_get_drvinfo(struct net_device *dev,
225212
struct ethtool_drvinfo *info)
@@ -791,7 +778,7 @@ static const struct net_device_ops emac_netdev_ops = {
791778
.ndo_start_xmit = emac_start_xmit,
792779
.ndo_tx_timeout = emac_timeout,
793780
.ndo_set_rx_mode = emac_set_rx_mode,
794-
.ndo_do_ioctl = emac_ioctl,
781+
.ndo_do_ioctl = phy_do_ioctl_running,
795782
.ndo_validate_addr = eth_validate_addr,
796783
.ndo_set_mac_address = emac_set_mac_address,
797784
#ifdef CONFIG_NET_POLL_CONTROLLER

drivers/net/ethernet/amd/au1000_eth.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,23 +1053,12 @@ static void au1000_multicast_list(struct net_device *dev)
10531053
writel(reg, &aup->mac->control);
10541054
}
10551055

1056-
static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1057-
{
1058-
if (!netif_running(dev))
1059-
return -EINVAL;
1060-
1061-
if (!dev->phydev)
1062-
return -EINVAL; /* PHY not controllable */
1063-
1064-
return phy_mii_ioctl(dev->phydev, rq, cmd);
1065-
}
1066-
10671056
static const struct net_device_ops au1000_netdev_ops = {
10681057
.ndo_open = au1000_open,
10691058
.ndo_stop = au1000_close,
10701059
.ndo_start_xmit = au1000_tx,
10711060
.ndo_set_rx_mode = au1000_multicast_list,
1072-
.ndo_do_ioctl = au1000_ioctl,
1061+
.ndo_do_ioctl = phy_do_ioctl_running,
10731062
.ndo_tx_timeout = au1000_tx_timeout,
10741063
.ndo_set_mac_address = eth_mac_addr,
10751064
.ndo_validate_addr = eth_validate_addr,

drivers/net/ethernet/arc/emac_main.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -781,18 +781,6 @@ static int arc_emac_set_address(struct net_device *ndev, void *p)
781781
return 0;
782782
}
783783

784-
static int arc_emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
785-
{
786-
if (!netif_running(dev))
787-
return -EINVAL;
788-
789-
if (!dev->phydev)
790-
return -ENODEV;
791-
792-
return phy_mii_ioctl(dev->phydev, rq, cmd);
793-
}
794-
795-
796784
/**
797785
* arc_emac_restart - Restart EMAC
798786
* @ndev: Pointer to net_device structure.
@@ -857,7 +845,7 @@ static const struct net_device_ops arc_emac_netdev_ops = {
857845
.ndo_set_mac_address = arc_emac_set_address,
858846
.ndo_get_stats = arc_emac_stats,
859847
.ndo_set_rx_mode = arc_emac_set_rx_mode,
860-
.ndo_do_ioctl = arc_emac_ioctl,
848+
.ndo_do_ioctl = phy_do_ioctl_running,
861849
#ifdef CONFIG_NET_POLL_CONTROLLER
862850
.ndo_poll_controller = arc_emac_poll_controller,
863851
#endif

drivers/net/ethernet/broadcom/bgmac.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,22 +1248,14 @@ static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
12481248
return 0;
12491249
}
12501250

1251-
static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
1252-
{
1253-
if (!netif_running(net_dev))
1254-
return -EINVAL;
1255-
1256-
return phy_mii_ioctl(net_dev->phydev, ifr, cmd);
1257-
}
1258-
12591251
static const struct net_device_ops bgmac_netdev_ops = {
12601252
.ndo_open = bgmac_open,
12611253
.ndo_stop = bgmac_stop,
12621254
.ndo_start_xmit = bgmac_start_xmit,
12631255
.ndo_set_rx_mode = bgmac_set_rx_mode,
12641256
.ndo_set_mac_address = bgmac_set_mac_address,
12651257
.ndo_validate_addr = eth_validate_addr,
1266-
.ndo_do_ioctl = bgmac_ioctl,
1258+
.ndo_do_ioctl = phy_do_ioctl_running,
12671259
};
12681260

12691261
/**************************************************

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,18 +1225,6 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
12251225
}
12261226
}
12271227

1228-
/* ioctl handle special commands that are not present in ethtool. */
1229-
static int bcmgenet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1230-
{
1231-
if (!netif_running(dev))
1232-
return -EINVAL;
1233-
1234-
if (!dev->phydev)
1235-
return -ENODEV;
1236-
1237-
return phy_mii_ioctl(dev->phydev, rq, cmd);
1238-
}
1239-
12401228
static struct enet_cb *bcmgenet_get_txcb(struct bcmgenet_priv *priv,
12411229
struct bcmgenet_tx_ring *ring)
12421230
{
@@ -3222,7 +3210,7 @@ static const struct net_device_ops bcmgenet_netdev_ops = {
32223210
.ndo_tx_timeout = bcmgenet_timeout,
32233211
.ndo_set_rx_mode = bcmgenet_set_rx_mode,
32243212
.ndo_set_mac_address = bcmgenet_set_mac_addr,
3225-
.ndo_do_ioctl = bcmgenet_ioctl,
3213+
.ndo_do_ioctl = phy_do_ioctl_running,
32263214
.ndo_set_features = bcmgenet_set_features,
32273215
#ifdef CONFIG_NET_POLL_CONTROLLER
32283216
.ndo_poll_controller = bcmgenet_poll_controller,

drivers/net/ethernet/dnet.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -725,19 +725,6 @@ static struct net_device_stats *dnet_get_stats(struct net_device *dev)
725725
return nstat;
726726
}
727727

728-
static int dnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
729-
{
730-
struct phy_device *phydev = dev->phydev;
731-
732-
if (!netif_running(dev))
733-
return -EINVAL;
734-
735-
if (!phydev)
736-
return -ENODEV;
737-
738-
return phy_mii_ioctl(phydev, rq, cmd);
739-
}
740-
741728
static void dnet_get_drvinfo(struct net_device *dev,
742729
struct ethtool_drvinfo *info)
743730
{
@@ -759,7 +746,7 @@ static const struct net_device_ops dnet_netdev_ops = {
759746
.ndo_stop = dnet_close,
760747
.ndo_get_stats = dnet_get_stats,
761748
.ndo_start_xmit = dnet_start_xmit,
762-
.ndo_do_ioctl = dnet_ioctl,
749+
.ndo_do_ioctl = phy_do_ioctl_running,
763750
.ndo_set_mac_address = eth_mac_addr,
764751
.ndo_validate_addr = eth_validate_addr,
765752
};

drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -882,14 +882,6 @@ static const struct ethtool_ops fs_ethtool_ops = {
882882
.set_tunable = fs_set_tunable,
883883
};
884884

885-
static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
886-
{
887-
if (!netif_running(dev))
888-
return -EINVAL;
889-
890-
return phy_mii_ioctl(dev->phydev, rq, cmd);
891-
}
892-
893885
extern int fs_mii_connect(struct net_device *dev);
894886
extern void fs_mii_disconnect(struct net_device *dev);
895887

@@ -907,7 +899,7 @@ static const struct net_device_ops fs_enet_netdev_ops = {
907899
.ndo_start_xmit = fs_enet_start_xmit,
908900
.ndo_tx_timeout = fs_timeout,
909901
.ndo_set_rx_mode = fs_set_multicast_list,
910-
.ndo_do_ioctl = fs_ioctl,
902+
.ndo_do_ioctl = phy_do_ioctl_running,
911903
.ndo_validate_addr = eth_validate_addr,
912904
.ndo_set_mac_address = eth_mac_addr,
913905
#ifdef CONFIG_NET_POLL_CONTROLLER

drivers/net/ethernet/hisilicon/hisi_femac.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -675,18 +675,6 @@ static void hisi_femac_net_set_rx_mode(struct net_device *dev)
675675
}
676676
}
677677

678-
static int hisi_femac_net_ioctl(struct net_device *dev,
679-
struct ifreq *ifreq, int cmd)
680-
{
681-
if (!netif_running(dev))
682-
return -EINVAL;
683-
684-
if (!dev->phydev)
685-
return -EINVAL;
686-
687-
return phy_mii_ioctl(dev->phydev, ifreq, cmd);
688-
}
689-
690678
static const struct ethtool_ops hisi_femac_ethtools_ops = {
691679
.get_link = ethtool_op_get_link,
692680
.get_link_ksettings = phy_ethtool_get_link_ksettings,
@@ -697,7 +685,7 @@ static const struct net_device_ops hisi_femac_netdev_ops = {
697685
.ndo_open = hisi_femac_net_open,
698686
.ndo_stop = hisi_femac_net_close,
699687
.ndo_start_xmit = hisi_femac_net_xmit,
700-
.ndo_do_ioctl = hisi_femac_net_ioctl,
688+
.ndo_do_ioctl = phy_do_ioctl_running,
701689
.ndo_set_mac_address = hisi_femac_set_mac_address,
702690
.ndo_set_rx_mode = hisi_femac_net_set_rx_mode,
703691
};

drivers/net/ethernet/hisilicon/hns/hns_enet.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,20 +1497,6 @@ static void hns_nic_net_timeout(struct net_device *ndev, unsigned int txqueue)
14971497
}
14981498
}
14991499

1500-
static int hns_nic_do_ioctl(struct net_device *netdev, struct ifreq *ifr,
1501-
int cmd)
1502-
{
1503-
struct phy_device *phy_dev = netdev->phydev;
1504-
1505-
if (!netif_running(netdev))
1506-
return -EINVAL;
1507-
1508-
if (!phy_dev)
1509-
return -ENOTSUPP;
1510-
1511-
return phy_mii_ioctl(phy_dev, ifr, cmd);
1512-
}
1513-
15141500
static netdev_tx_t hns_nic_net_xmit(struct sk_buff *skb,
15151501
struct net_device *ndev)
15161502
{
@@ -1958,7 +1944,7 @@ static const struct net_device_ops hns_nic_netdev_ops = {
19581944
.ndo_tx_timeout = hns_nic_net_timeout,
19591945
.ndo_set_mac_address = hns_nic_net_set_mac_address,
19601946
.ndo_change_mtu = hns_nic_change_mtu,
1961-
.ndo_do_ioctl = hns_nic_do_ioctl,
1947+
.ndo_do_ioctl = phy_do_ioctl_running,
19621948
.ndo_set_features = hns_nic_set_features,
19631949
.ndo_fix_features = hns_nic_fix_features,
19641950
.ndo_get_stats64 = hns_nic_get_stats64,

drivers/net/ethernet/nxp/lpc_eth.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,19 +1149,6 @@ static void lpc_eth_set_multicast_list(struct net_device *ndev)
11491149
spin_unlock_irqrestore(&pldat->lock, flags);
11501150
}
11511151

1152-
static int lpc_eth_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
1153-
{
1154-
struct phy_device *phydev = ndev->phydev;
1155-
1156-
if (!netif_running(ndev))
1157-
return -EINVAL;
1158-
1159-
if (!phydev)
1160-
return -ENODEV;
1161-
1162-
return phy_mii_ioctl(phydev, req, cmd);
1163-
}
1164-
11651152
static int lpc_eth_open(struct net_device *ndev)
11661153
{
11671154
struct netdata_local *pldat = netdev_priv(ndev);
@@ -1229,7 +1216,7 @@ static const struct net_device_ops lpc_netdev_ops = {
12291216
.ndo_stop = lpc_eth_close,
12301217
.ndo_start_xmit = lpc_eth_hard_start_xmit,
12311218
.ndo_set_rx_mode = lpc_eth_set_multicast_list,
1232-
.ndo_do_ioctl = lpc_eth_ioctl,
1219+
.ndo_do_ioctl = phy_do_ioctl_running,
12331220
.ndo_set_mac_address = lpc_set_mac_address,
12341221
.ndo_validate_addr = eth_validate_addr,
12351222
};

drivers/net/ethernet/qualcomm/emac/emac.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -289,18 +289,6 @@ static void emac_tx_timeout(struct net_device *netdev, unsigned int txqueue)
289289
schedule_work(&adpt->work_thread);
290290
}
291291

292-
/* IOCTL support for the interface */
293-
static int emac_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
294-
{
295-
if (!netif_running(netdev))
296-
return -EINVAL;
297-
298-
if (!netdev->phydev)
299-
return -ENODEV;
300-
301-
return phy_mii_ioctl(netdev->phydev, ifr, cmd);
302-
}
303-
304292
/**
305293
* emac_update_hw_stats - read the EMAC stat registers
306294
*
@@ -387,7 +375,7 @@ static const struct net_device_ops emac_netdev_ops = {
387375
.ndo_start_xmit = emac_start_xmit,
388376
.ndo_set_mac_address = eth_mac_addr,
389377
.ndo_change_mtu = emac_change_mtu,
390-
.ndo_do_ioctl = emac_ioctl,
378+
.ndo_do_ioctl = phy_do_ioctl_running,
391379
.ndo_tx_timeout = emac_tx_timeout,
392380
.ndo_get_stats64 = emac_get_stats64,
393381
.ndo_set_features = emac_set_features,

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2647,20 +2647,6 @@ static int sh_eth_close(struct net_device *ndev)
26472647
return 0;
26482648
}
26492649

2650-
/* ioctl to device function */
2651-
static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
2652-
{
2653-
struct phy_device *phydev = ndev->phydev;
2654-
2655-
if (!netif_running(ndev))
2656-
return -EINVAL;
2657-
2658-
if (!phydev)
2659-
return -ENODEV;
2660-
2661-
return phy_mii_ioctl(phydev, rq, cmd);
2662-
}
2663-
26642650
static int sh_eth_change_mtu(struct net_device *ndev, int new_mtu)
26652651
{
26662652
if (netif_running(ndev))
@@ -3159,7 +3145,7 @@ static const struct net_device_ops sh_eth_netdev_ops = {
31593145
.ndo_get_stats = sh_eth_get_stats,
31603146
.ndo_set_rx_mode = sh_eth_set_rx_mode,
31613147
.ndo_tx_timeout = sh_eth_tx_timeout,
3162-
.ndo_do_ioctl = sh_eth_do_ioctl,
3148+
.ndo_do_ioctl = phy_do_ioctl_running,
31633149
.ndo_change_mtu = sh_eth_change_mtu,
31643150
.ndo_validate_addr = eth_validate_addr,
31653151
.ndo_set_mac_address = eth_mac_addr,
@@ -3175,7 +3161,7 @@ static const struct net_device_ops sh_eth_netdev_ops_tsu = {
31753161
.ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid,
31763162
.ndo_vlan_rx_kill_vid = sh_eth_vlan_rx_kill_vid,
31773163
.ndo_tx_timeout = sh_eth_tx_timeout,
3178-
.ndo_do_ioctl = sh_eth_do_ioctl,
3164+
.ndo_do_ioctl = phy_do_ioctl_running,
31793165
.ndo_change_mtu = sh_eth_change_mtu,
31803166
.ndo_validate_addr = eth_validate_addr,
31813167
.ndo_set_mac_address = eth_mac_addr,

drivers/net/ethernet/smsc/smsc911x.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,15 +1943,6 @@ static int smsc911x_set_mac_address(struct net_device *dev, void *p)
19431943
return 0;
19441944
}
19451945

1946-
/* Standard ioctls for mii-tool */
1947-
static int smsc911x_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1948-
{
1949-
if (!netif_running(dev) || !dev->phydev)
1950-
return -EINVAL;
1951-
1952-
return phy_mii_ioctl(dev->phydev, ifr, cmd);
1953-
}
1954-
19551946
static void smsc911x_ethtool_getdrvinfo(struct net_device *dev,
19561947
struct ethtool_drvinfo *info)
19571948
{
@@ -2151,7 +2142,7 @@ static const struct net_device_ops smsc911x_netdev_ops = {
21512142
.ndo_start_xmit = smsc911x_hard_start_xmit,
21522143
.ndo_get_stats = smsc911x_get_stats,
21532144
.ndo_set_rx_mode = smsc911x_set_multicast_list,
2154-
.ndo_do_ioctl = smsc911x_do_ioctl,
2145+
.ndo_do_ioctl = phy_do_ioctl_running,
21552146
.ndo_validate_addr = eth_validate_addr,
21562147
.ndo_set_mac_address = smsc911x_set_mac_address,
21572148
#ifdef CONFIG_NET_POLL_CONTROLLER

drivers/net/ethernet/smsc/smsc9420.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,6 @@ static int smsc9420_eeprom_reload(struct smsc9420_pdata *pd)
210210
return -EIO;
211211
}
212212

213-
/* Standard ioctls for mii-tool */
214-
static int smsc9420_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
215-
{
216-
if (!netif_running(dev) || !dev->phydev)
217-
return -EINVAL;
218-
219-
return phy_mii_ioctl(dev->phydev, ifr, cmd);
220-
}
221-
222213
static void smsc9420_ethtool_get_drvinfo(struct net_device *netdev,
223214
struct ethtool_drvinfo *drvinfo)
224215
{
@@ -1504,7 +1495,7 @@ static const struct net_device_ops smsc9420_netdev_ops = {
15041495
.ndo_start_xmit = smsc9420_hard_start_xmit,
15051496
.ndo_get_stats = smsc9420_get_stats,
15061497
.ndo_set_rx_mode = smsc9420_set_multicast_list,
1507-
.ndo_do_ioctl = smsc9420_do_ioctl,
1498+
.ndo_do_ioctl = phy_do_ioctl_running,
15081499
.ndo_validate_addr = eth_validate_addr,
15091500
.ndo_set_mac_address = eth_mac_addr,
15101501
#ifdef CONFIG_NET_POLL_CONTROLLER

0 commit comments

Comments
 (0)