diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-09-03 06:41:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-03 23:02:12 -0400 |
commit | 0fa0ee053aaa53939306376719450cfe56e33e3b (patch) | |
tree | dcfa68400c09f079f260d1df9db2e47e4be2f2ea /drivers/net/pcmcia/3c574_cs.c | |
parent | 7ab0f2736bfe137a82a7084bbfb5f809da95cabd (diff) |
netdev: Convert MDIO ioctl implementation to use struct mii_ioctl_data
A few drivers still access the arguments to MDIO ioctls as an array of
u16. Convert them to use struct mii_ioctl_data.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pcmcia/3c574_cs.c')
-rw-r--r-- | drivers/net/pcmcia/3c574_cs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index d836af1b9034..ee8ad3e180dd 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -85,6 +85,7 @@ earlier 3Com products. | |||
85 | #include <linux/ioport.h> | 85 | #include <linux/ioport.h> |
86 | #include <linux/ethtool.h> | 86 | #include <linux/ethtool.h> |
87 | #include <linux/bitops.h> | 87 | #include <linux/bitops.h> |
88 | #include <linux/mii.h> | ||
88 | 89 | ||
89 | #include <pcmcia/cs_types.h> | 90 | #include <pcmcia/cs_types.h> |
90 | #include <pcmcia/cs.h> | 91 | #include <pcmcia/cs.h> |
@@ -1096,16 +1097,16 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1096 | { | 1097 | { |
1097 | struct el3_private *lp = netdev_priv(dev); | 1098 | struct el3_private *lp = netdev_priv(dev); |
1098 | unsigned int ioaddr = dev->base_addr; | 1099 | unsigned int ioaddr = dev->base_addr; |
1099 | u16 *data = (u16 *)&rq->ifr_ifru; | 1100 | struct mii_ioctl_data *data = if_mii(rq); |
1100 | int phy = lp->phys & 0x1f; | 1101 | int phy = lp->phys & 0x1f; |
1101 | 1102 | ||
1102 | DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", | 1103 | DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", |
1103 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, | 1104 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, |
1104 | data[0], data[1], data[2], data[3]); | 1105 | data->phy_id, data->reg_num, data->val_in, data->val_out); |
1105 | 1106 | ||
1106 | switch(cmd) { | 1107 | switch(cmd) { |
1107 | case SIOCGMIIPHY: /* Get the address of the PHY in use. */ | 1108 | case SIOCGMIIPHY: /* Get the address of the PHY in use. */ |
1108 | data[0] = phy; | 1109 | data->phy_id = phy; |
1109 | case SIOCGMIIREG: /* Read the specified MII register. */ | 1110 | case SIOCGMIIREG: /* Read the specified MII register. */ |
1110 | { | 1111 | { |
1111 | int saved_window; | 1112 | int saved_window; |
@@ -1114,7 +1115,8 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1114 | spin_lock_irqsave(&lp->window_lock, flags); | 1115 | spin_lock_irqsave(&lp->window_lock, flags); |
1115 | saved_window = inw(ioaddr + EL3_CMD) >> 13; | 1116 | saved_window = inw(ioaddr + EL3_CMD) >> 13; |
1116 | EL3WINDOW(4); | 1117 | EL3WINDOW(4); |
1117 | data[3] = mdio_read(ioaddr, data[0] & 0x1f, data[1] & 0x1f); | 1118 | data->val_out = mdio_read(ioaddr, data->phy_id & 0x1f, |
1119 | data->reg_num & 0x1f); | ||
1118 | EL3WINDOW(saved_window); | 1120 | EL3WINDOW(saved_window); |
1119 | spin_unlock_irqrestore(&lp->window_lock, flags); | 1121 | spin_unlock_irqrestore(&lp->window_lock, flags); |
1120 | return 0; | 1122 | return 0; |
@@ -1127,7 +1129,8 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1127 | spin_lock_irqsave(&lp->window_lock, flags); | 1129 | spin_lock_irqsave(&lp->window_lock, flags); |
1128 | saved_window = inw(ioaddr + EL3_CMD) >> 13; | 1130 | saved_window = inw(ioaddr + EL3_CMD) >> 13; |
1129 | EL3WINDOW(4); | 1131 | EL3WINDOW(4); |
1130 | mdio_write(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2]); | 1132 | mdio_write(ioaddr, data->phy_id & 0x1f, |
1133 | data->reg_num & 0x1f, data->val_in); | ||
1131 | EL3WINDOW(saved_window); | 1134 | EL3WINDOW(saved_window); |
1132 | spin_unlock_irqrestore(&lp->window_lock, flags); | 1135 | spin_unlock_irqrestore(&lp->window_lock, flags); |
1133 | return 0; | 1136 | return 0; |