Commit f71c419e authored by Jeff Garzik's avatar Jeff Garzik

[net drivers] add optional duplex-changed arg to generic_mii_ioctl helper

parent ec7689a2
...@@ -1664,9 +1664,9 @@ static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1664,9 +1664,9 @@ static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
if (cmd == SIOCETHTOOL) if (cmd == SIOCETHTOOL)
return cp_ethtool_ioctl(cp, (void *) rq->ifr_data); return cp_ethtool_ioctl(cp, (void *) rq->ifr_data);
rc = generic_mii_ioctl(&cp->mii_if, mii, cmd); spin_lock_irq(&cp->lock);
if (rc == 1) /* we don't care about duplex change, fixup rc */ rc = generic_mii_ioctl(&cp->mii_if, mii, cmd, NULL);
rc = 0; spin_unlock_irq(&cp->lock);
return rc; return rc;
} }
......
...@@ -2454,11 +2454,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -2454,11 +2454,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
else { else {
spin_lock_irq(&np->lock); spin_lock_irq(&np->lock);
rc = generic_mii_ioctl(&np->mii, data, cmd); rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
spin_unlock_irq(&np->lock); spin_unlock_irq(&np->lock);
if (rc == 1) /* don't care about duplex change, fix up rc */
rc = 0;
} }
return rc; return rc;
......
...@@ -1446,10 +1446,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1446,10 +1446,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
/* all other ioctls (the SIOC[GS]MIIxxx ioctls) */ /* all other ioctls (the SIOC[GS]MIIxxx ioctls) */
else { else {
spin_lock_irq(&np->lock); spin_lock_irq(&np->lock);
rc = generic_mii_ioctl(&np->mii, data, cmd); rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
spin_unlock_irq(&np->lock); spin_unlock_irq(&np->lock);
if (rc == 1) /* don't care about duplex change, fixup rc */
rc = 0;
} }
/* power-down, if interface is down */ /* power-down, if interface is down */
......
...@@ -1847,10 +1847,8 @@ static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1847,10 +1847,8 @@ static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
else { else {
spin_lock_irq(&np->lock); spin_lock_irq(&np->lock);
rc = generic_mii_ioctl(&np->mii, data, cmd); rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
spin_unlock_irq(&np->lock); spin_unlock_irq(&np->lock);
if (rc == 1) /* don't care about duplex change, fix up rc */
rc = 0;
} }
return rc; return rc;
......
...@@ -262,11 +262,15 @@ unsigned int mii_check_media (struct mii_if_info *mii, ...@@ -262,11 +262,15 @@ unsigned int mii_check_media (struct mii_if_info *mii,
} }
int generic_mii_ioctl(struct mii_if_info *mii_if, int generic_mii_ioctl(struct mii_if_info *mii_if,
struct mii_ioctl_data *mii_data, int cmd) struct mii_ioctl_data *mii_data, int cmd,
unsigned int *duplex_chg_out)
{ {
int rc = 0; int rc = 0;
unsigned int duplex_changed = 0; unsigned int duplex_changed = 0;
if (duplex_chg_out)
*duplex_chg_out = 0;
mii_data->phy_id &= mii_if->phy_id_mask; mii_data->phy_id &= mii_if->phy_id_mask;
mii_data->reg_num &= mii_if->reg_num_mask; mii_data->reg_num &= mii_if->reg_num_mask;
...@@ -323,8 +327,9 @@ int generic_mii_ioctl(struct mii_if_info *mii_if, ...@@ -323,8 +327,9 @@ int generic_mii_ioctl(struct mii_if_info *mii_if,
break; break;
} }
if ((rc == 0) && (duplex_changed)) if ((rc == 0) && (duplex_chg_out) && (duplex_changed))
rc = 1; *duplex_chg_out = 1;
return rc; return rc;
} }
......
...@@ -1564,10 +1564,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1564,10 +1564,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
else { else {
spin_lock_irq(&np->lock); spin_lock_irq(&np->lock);
rc = generic_mii_ioctl(&np->mii_if, data, cmd); rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL);
spin_unlock_irq(&np->lock); spin_unlock_irq(&np->lock);
if (rc == 1) /* don't care about duplex change, fix up rc */
rc = 0;
} }
return rc; return rc;
......
...@@ -1686,10 +1686,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1686,10 +1686,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
else { else {
spin_lock_irq(&np->lock); spin_lock_irq(&np->lock);
rc = generic_mii_ioctl(&np->mii_if, data, cmd); rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL);
spin_unlock_irq(&np->lock); spin_unlock_irq(&np->lock);
if (rc == 1) /* don't care about duplex change, fix up rc */
rc = 0;
} }
return rc; return rc;
......
...@@ -130,7 +130,8 @@ extern unsigned int mii_check_media (struct mii_if_info *mii, ...@@ -130,7 +130,8 @@ extern unsigned int mii_check_media (struct mii_if_info *mii,
unsigned int ok_to_print, unsigned int ok_to_print,
unsigned int init_media); unsigned int init_media);
extern int generic_mii_ioctl(struct mii_if_info *mii_if, extern int generic_mii_ioctl(struct mii_if_info *mii_if,
struct mii_ioctl_data *mii_data, int cmd); struct mii_ioctl_data *mii_data, int cmd,
unsigned int *duplex_changed);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment