aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2010-07-17 04:48:55 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-18 22:15:25 -0400
commit28b041139e344ecd0f144d6205b004ae354cfa1e (patch)
tree7fc0e05d01717da0410a7b3252b0cac3fc8db81d /drivers
parent4507a71507d4ff37e9a499c4241b7701ed1feab4 (diff)
net: preserve ifreq parameter when calling generic phy_mii_ioctl().
The phy_mii_ioctl() function unnecessarily throws away the original ifreq. We need access to the ifreq in order to support PHYs that can perform hardware time stamping. Two maverick drivers filter the ioctl commands passed to phy_mii_ioctl(). This is unnecessary since phylib will check the command in any case. Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/arm/ixp4xx_eth.c3
-rw-r--r--drivers/net/au1000_eth.c2
-rw-r--r--drivers/net/bcm63xx_enet.c2
-rw-r--r--drivers/net/cpmac.c5
-rw-r--r--drivers/net/dnet.c2
-rw-r--r--drivers/net/ethoc.c2
-rw-r--r--drivers/net/fec.c2
-rw-r--r--drivers/net/fec_mpc52xx.c2
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c3
-rw-r--r--drivers/net/gianfar.c2
-rw-r--r--drivers/net/macb.c2
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/octeon/octeon_mgmt.c2
-rw-r--r--drivers/net/phy/phy.c3
-rw-r--r--drivers/net/sb1250-mac.c2
-rw-r--r--drivers/net/sh_eth.c2
-rw-r--r--drivers/net/smsc911x.c2
-rw-r--r--drivers/net/smsc9420.c2
-rw-r--r--drivers/net/stmmac/stmmac_main.c22
-rw-r--r--drivers/net/tc35815.c2
-rw-r--r--drivers/net/tg3.c2
-rw-r--r--drivers/net/ucc_geth.c2
-rw-r--r--drivers/staging/octeon/ethernet-mdio.c2
23 files changed, 32 insertions, 40 deletions
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index ee2f8425dbe7..4f1cc7164ad9 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -782,7 +782,8 @@ static int eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
782 782
783 if (!netif_running(dev)) 783 if (!netif_running(dev))
784 return -EINVAL; 784 return -EINVAL;
785 return phy_mii_ioctl(port->phydev, if_mii(req), cmd); 785
786 return phy_mii_ioctl(port->phydev, req, cmd);
786} 787}
787 788
788/* ethtool support */ 789/* ethtool support */
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index ece6128bef14..386d4feec652 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -978,7 +978,7 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
978 if (!aup->phy_dev) 978 if (!aup->phy_dev)
979 return -EINVAL; /* PHY not controllable */ 979 return -EINVAL; /* PHY not controllable */
980 980
981 return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd); 981 return phy_mii_ioctl(aup->phy_dev, rq, cmd);
982} 982}
983 983
984static const struct net_device_ops au1000_netdev_ops = { 984static const struct net_device_ops au1000_netdev_ops = {
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c
index faf5add894d7..0d2c5da08937 100644
--- a/drivers/net/bcm63xx_enet.c
+++ b/drivers/net/bcm63xx_enet.c
@@ -1496,7 +1496,7 @@ static int bcm_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1496 if (priv->has_phy) { 1496 if (priv->has_phy) {
1497 if (!priv->phydev) 1497 if (!priv->phydev)
1498 return -ENODEV; 1498 return -ENODEV;
1499 return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd); 1499 return phy_mii_ioctl(priv->phydev, rq, cmd);
1500 } else { 1500 } else {
1501 struct mii_if_info mii; 1501 struct mii_if_info mii;
1502 1502
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 38de1a4f825f..e1f6156b3710 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -846,11 +846,8 @@ static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
846 return -EINVAL; 846 return -EINVAL;
847 if (!priv->phy) 847 if (!priv->phy)
848 return -EINVAL; 848 return -EINVAL;
849 if ((cmd == SIOCGMIIPHY) || (cmd == SIOCGMIIREG) ||
850 (cmd == SIOCSMIIREG))
851 return phy_mii_ioctl(priv->phy, if_mii(ifr), cmd);
852 849
853 return -EOPNOTSUPP; 850 return phy_mii_ioctl(priv->phy, ifr, cmd);
854} 851}
855 852
856static int cpmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 853static int cpmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 8b0f50bbf3e5..4ea7141f525d 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -797,7 +797,7 @@ static int dnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
797 if (!phydev) 797 if (!phydev)
798 return -ENODEV; 798 return -ENODEV;
799 799
800 return phy_mii_ioctl(phydev, if_mii(rq), cmd); 800 return phy_mii_ioctl(phydev, rq, cmd);
801} 801}
802 802
803static void dnet_get_drvinfo(struct net_device *dev, 803static void dnet_get_drvinfo(struct net_device *dev,
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 5bb6bb74c40e..38c282e6565b 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -730,7 +730,7 @@ static int ethoc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
730 phy = priv->phy; 730 phy = priv->phy;
731 } 731 }
732 732
733 return phy_mii_ioctl(phy, mdio, cmd); 733 return phy_mii_ioctl(phy, ifr, cmd);
734} 734}
735 735
736static int ethoc_config(struct net_device *dev, struct ifmap *map) 736static int ethoc_config(struct net_device *dev, struct ifmap *map)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 937f1b4a3483..391a553a3add 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -825,7 +825,7 @@ static int fec_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
825 if (!phydev) 825 if (!phydev)
826 return -ENODEV; 826 return -ENODEV;
827 827
828 return phy_mii_ioctl(phydev, if_mii(rq), cmd); 828 return phy_mii_ioctl(phydev, rq, cmd);
829} 829}
830 830
831static void fec_enet_free_buffers(struct net_device *dev) 831static void fec_enet_free_buffers(struct net_device *dev)
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 5f8346369b80..d1a5b17b2a95 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -826,7 +826,7 @@ static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
826 if (!priv->phydev) 826 if (!priv->phydev)
827 return -ENOTSUPP; 827 return -ENOTSUPP;
828 828
829 return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd); 829 return phy_mii_ioctl(priv->phydev, rq, cmd);
830} 830}
831 831
832static const struct net_device_ops mpc52xx_fec_netdev_ops = { 832static const struct net_device_ops mpc52xx_fec_netdev_ops = {
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 309a0eaddd81..f08cff9020bd 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -963,12 +963,11 @@ static const struct ethtool_ops fs_ethtool_ops = {
963static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 963static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
964{ 964{
965 struct fs_enet_private *fep = netdev_priv(dev); 965 struct fs_enet_private *fep = netdev_priv(dev);
966 struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&rq->ifr_data;
967 966
968 if (!netif_running(dev)) 967 if (!netif_running(dev))
969 return -EINVAL; 968 return -EINVAL;
970 969
971 return phy_mii_ioctl(fep->phydev, mii, cmd); 970 return phy_mii_ioctl(fep->phydev, rq, cmd);
972} 971}
973 972
974extern int fs_mii_connect(struct net_device *dev); 973extern int fs_mii_connect(struct net_device *dev);
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 746a776a1653..27f02970d898 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -847,7 +847,7 @@ static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
847 if (!priv->phydev) 847 if (!priv->phydev)
848 return -ENODEV; 848 return -ENODEV;
849 849
850 return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd); 850 return phy_mii_ioctl(priv->phydev, rq, cmd);
851} 851}
852 852
853static unsigned int reverse_bitmap(unsigned int bit_map, unsigned int max_qs) 853static unsigned int reverse_bitmap(unsigned int bit_map, unsigned int max_qs)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 40797fbdca9f..ff2f158ab0b9 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1082,7 +1082,7 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1082 if (!phydev) 1082 if (!phydev)
1083 return -ENODEV; 1083 return -ENODEV;
1084 1084
1085 return phy_mii_ioctl(phydev, if_mii(rq), cmd); 1085 return phy_mii_ioctl(phydev, rq, cmd);
1086} 1086}
1087 1087
1088static const struct net_device_ops macb_netdev_ops = { 1088static const struct net_device_ops macb_netdev_ops = {
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index af075af20e0c..2fcdb1e1b99d 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -2461,7 +2461,7 @@ static int mv643xx_eth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2461 struct mv643xx_eth_private *mp = netdev_priv(dev); 2461 struct mv643xx_eth_private *mp = netdev_priv(dev);
2462 2462
2463 if (mp->phy != NULL) 2463 if (mp->phy != NULL)
2464 return phy_mii_ioctl(mp->phy, if_mii(ifr), cmd); 2464 return phy_mii_ioctl(mp->phy, ifr, cmd);
2465 2465
2466 return -EOPNOTSUPP; 2466 return -EOPNOTSUPP;
2467} 2467}
diff --git a/drivers/net/octeon/octeon_mgmt.c b/drivers/net/octeon/octeon_mgmt.c
index f4a0f08e14e1..b264f0f45605 100644
--- a/drivers/net/octeon/octeon_mgmt.c
+++ b/drivers/net/octeon/octeon_mgmt.c
@@ -620,7 +620,7 @@ static int octeon_mgmt_ioctl(struct net_device *netdev,
620 if (!p->phydev) 620 if (!p->phydev)
621 return -EINVAL; 621 return -EINVAL;
622 622
623 return phy_mii_ioctl(p->phydev, if_mii(rq), cmd); 623 return phy_mii_ioctl(p->phydev, rq, cmd);
624} 624}
625 625
626static void octeon_mgmt_adjust_link(struct net_device *netdev) 626static void octeon_mgmt_adjust_link(struct net_device *netdev)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 64be4664ccab..bd88d818f082 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -309,8 +309,9 @@ EXPORT_SYMBOL(phy_ethtool_gset);
309 * current state. Use at own risk. 309 * current state. Use at own risk.
310 */ 310 */
311int phy_mii_ioctl(struct phy_device *phydev, 311int phy_mii_ioctl(struct phy_device *phydev,
312 struct mii_ioctl_data *mii_data, int cmd) 312 struct ifreq *ifr, int cmd)
313{ 313{
314 struct mii_ioctl_data *mii_data = if_mii(ifr);
314 u16 val = mii_data->val_in; 315 u16 val = mii_data->val_in;
315 316
316 switch (cmd) { 317 switch (cmd) {
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 79eee3062083..8e6bd45b9f31 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2532,7 +2532,7 @@ static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2532 if (!netif_running(dev) || !sc->phy_dev) 2532 if (!netif_running(dev) || !sc->phy_dev)
2533 return -EINVAL; 2533 return -EINVAL;
2534 2534
2535 return phy_mii_ioctl(sc->phy_dev, if_mii(rq), cmd); 2535 return phy_mii_ioctl(sc->phy_dev, rq, cmd);
2536} 2536}
2537 2537
2538static int sbmac_close(struct net_device *dev) 2538static int sbmac_close(struct net_device *dev)
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 7ac814d932b1..32f2deaa38bb 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -1284,7 +1284,7 @@ static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq,
1284 if (!phydev) 1284 if (!phydev)
1285 return -ENODEV; 1285 return -ENODEV;
1286 1286
1287 return phy_mii_ioctl(phydev, if_mii(rq), cmd); 1287 return phy_mii_ioctl(phydev, rq, cmd);
1288} 1288}
1289 1289
1290#if defined(SH_ETH_HAS_TSU) 1290#if defined(SH_ETH_HAS_TSU)
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index cc559741b0fa..56dc2ff75ee3 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -1538,7 +1538,7 @@ static int smsc911x_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1538 if (!netif_running(dev) || !pdata->phy_dev) 1538 if (!netif_running(dev) || !pdata->phy_dev)
1539 return -EINVAL; 1539 return -EINVAL;
1540 1540
1541 return phy_mii_ioctl(pdata->phy_dev, if_mii(ifr), cmd); 1541 return phy_mii_ioctl(pdata->phy_dev, ifr, cmd);
1542} 1542}
1543 1543
1544static int 1544static int
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index 6cdee6a15f9f..b09ee1c319e8 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -245,7 +245,7 @@ static int smsc9420_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
245 if (!netif_running(dev) || !pd->phy_dev) 245 if (!netif_running(dev) || !pd->phy_dev)
246 return -EINVAL; 246 return -EINVAL;
247 247
248 return phy_mii_ioctl(pd->phy_dev, if_mii(ifr), cmd); 248 return phy_mii_ioctl(pd->phy_dev, ifr, cmd);
249} 249}
250 250
251static int smsc9420_ethtool_get_settings(struct net_device *dev, 251static int smsc9420_ethtool_get_settings(struct net_device *dev,
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index a31d580f306d..acf061686940 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1437,24 +1437,18 @@ static void stmmac_poll_controller(struct net_device *dev)
1437static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1437static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1438{ 1438{
1439 struct stmmac_priv *priv = netdev_priv(dev); 1439 struct stmmac_priv *priv = netdev_priv(dev);
1440 int ret = -EOPNOTSUPP; 1440 int ret;
1441 1441
1442 if (!netif_running(dev)) 1442 if (!netif_running(dev))
1443 return -EINVAL; 1443 return -EINVAL;
1444 1444
1445 switch (cmd) { 1445 if (!priv->phydev)
1446 case SIOCGMIIPHY: 1446 return -EINVAL;
1447 case SIOCGMIIREG: 1447
1448 case SIOCSMIIREG: 1448 spin_lock(&priv->lock);
1449 if (!priv->phydev) 1449 ret = phy_mii_ioctl(priv->phydev, rq, cmd);
1450 return -EINVAL; 1450 spin_unlock(&priv->lock);
1451 1451
1452 spin_lock(&priv->lock);
1453 ret = phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
1454 spin_unlock(&priv->lock);
1455 default:
1456 break;
1457 }
1458 return ret; 1452 return ret;
1459} 1453}
1460 1454
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index be08b75dbc15..99e423a5b9f1 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -2066,7 +2066,7 @@ static int tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2066 return -EINVAL; 2066 return -EINVAL;
2067 if (!lp->phy_dev) 2067 if (!lp->phy_dev)
2068 return -ENODEV; 2068 return -ENODEV;
2069 return phy_mii_ioctl(lp->phy_dev, if_mii(rq), cmd); 2069 return phy_mii_ioctl(lp->phy_dev, rq, cmd);
2070} 2070}
2071 2071
2072static void tc35815_chip_reset(struct net_device *dev) 2072static void tc35815_chip_reset(struct net_device *dev)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5769e1507d2f..b26a57782939 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10932,7 +10932,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
10932 if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED)) 10932 if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED))
10933 return -EAGAIN; 10933 return -EAGAIN;
10934 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 10934 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
10935 return phy_mii_ioctl(phydev, data, cmd); 10935 return phy_mii_ioctl(phydev, ifr, cmd);
10936 } 10936 }
10937 10937
10938 switch (cmd) { 10938 switch (cmd) {
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index dc32a62e611c..e17dd7430915 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3714,7 +3714,7 @@ static int ucc_geth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
3714 if (!ugeth->phydev) 3714 if (!ugeth->phydev)
3715 return -ENODEV; 3715 return -ENODEV;
3716 3716
3717 return phy_mii_ioctl(ugeth->phydev, if_mii(rq), cmd); 3717 return phy_mii_ioctl(ugeth->phydev, rq, cmd);
3718} 3718}
3719 3719
3720static const struct net_device_ops ucc_geth_netdev_ops = { 3720static const struct net_device_ops ucc_geth_netdev_ops = {
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index 7e0be8d00dc3..10a82ef30215 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -113,7 +113,7 @@ int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
113 if (!priv->phydev) 113 if (!priv->phydev)
114 return -EINVAL; 114 return -EINVAL;
115 115
116 return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd); 116 return phy_mii_ioctl(priv->phydev, rq, cmd);
117} 117}
118 118
119static void cvm_oct_adjust_link(struct net_device *dev) 119static void cvm_oct_adjust_link(struct net_device *dev)