netdev: Remove redundant checks for CAP_NET_ADMIN in MDIO implementations
dev_ioctl() already checks capable(CAP_NET_ADMIN) before calling the driver's implementation of MDIO ioctls. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
aae5e7c30f
Коммит
7ab0f2736b
|
@ -1524,9 +1524,6 @@ static int amd8111e_ioctl(struct net_device * dev , struct ifreq *ifr, int cmd)
|
||||||
int err;
|
int err;
|
||||||
u32 mii_regval;
|
u32 mii_regval;
|
||||||
|
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
case SIOCGMIIPHY:
|
case SIOCGMIIPHY:
|
||||||
data->phy_id = lp->ext_phy_addr;
|
data->phy_id = lp->ext_phy_addr;
|
||||||
|
|
|
@ -534,10 +534,6 @@ static int atl1c_mii_ioctl(struct net_device *netdev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCGMIIREG:
|
case SIOCGMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN)) {
|
|
||||||
retval = -EPERM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (atl1c_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
|
if (atl1c_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
|
||||||
&data->val_out)) {
|
&data->val_out)) {
|
||||||
retval = -EIO;
|
retval = -EIO;
|
||||||
|
@ -546,10 +542,6 @@ static int atl1c_mii_ioctl(struct net_device *netdev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN)) {
|
|
||||||
retval = -EPERM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (data->reg_num & ~(0x1F)) {
|
if (data->reg_num & ~(0x1F)) {
|
||||||
retval = -EFAULT;
|
retval = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -453,10 +453,6 @@ static int atl1e_mii_ioctl(struct net_device *netdev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCGMIIREG:
|
case SIOCGMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN)) {
|
|
||||||
retval = -EPERM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (atl1e_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
|
if (atl1e_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
|
||||||
&data->val_out)) {
|
&data->val_out)) {
|
||||||
retval = -EIO;
|
retval = -EIO;
|
||||||
|
@ -465,10 +461,6 @@ static int atl1e_mii_ioctl(struct net_device *netdev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN)) {
|
|
||||||
retval = -EPERM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (data->reg_num & ~(0x1F)) {
|
if (data->reg_num & ~(0x1F)) {
|
||||||
retval = -EFAULT;
|
retval = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -966,8 +966,6 @@ static int atl2_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
|
||||||
data->phy_id = 0;
|
data->phy_id = 0;
|
||||||
break;
|
break;
|
||||||
case SIOCGMIIREG:
|
case SIOCGMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
spin_lock_irqsave(&adapter->stats_lock, flags);
|
spin_lock_irqsave(&adapter->stats_lock, flags);
|
||||||
if (atl2_read_phy_reg(&adapter->hw,
|
if (atl2_read_phy_reg(&adapter->hw,
|
||||||
data->reg_num & 0x1F, &data->val_out)) {
|
data->reg_num & 0x1F, &data->val_out)) {
|
||||||
|
@ -977,8 +975,6 @@ static int atl2_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
|
||||||
spin_unlock_irqrestore(&adapter->stats_lock, flags);
|
spin_unlock_irqrestore(&adapter->stats_lock, flags);
|
||||||
break;
|
break;
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
if (data->reg_num & ~(0x1F))
|
if (data->reg_num & ~(0x1F))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
spin_lock_irqsave(&adapter->stats_lock, flags);
|
spin_lock_irqsave(&adapter->stats_lock, flags);
|
||||||
|
|
|
@ -7480,9 +7480,6 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
if (bp->phy_flags & BNX2_PHY_FLAG_REMOTE_PHY_CAP)
|
if (bp->phy_flags & BNX2_PHY_FLAG_REMOTE_PHY_CAP)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
|
|
@ -4875,10 +4875,6 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN)) {
|
|
||||||
rc = -EPERM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
spin_lock_irqsave(&cp->lock, flags);
|
spin_lock_irqsave(&cp->lock, flags);
|
||||||
cas_mif_poll(cp, 0);
|
cas_mif_poll(cp, 0);
|
||||||
rc = cas_phy_write(cp, data->reg_num & 0x1f, data->val_in);
|
rc = cas_phy_write(cp, data->reg_num & 0x1f, data->val_in);
|
||||||
|
|
|
@ -4714,8 +4714,6 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
|
||||||
data->phy_id = hw->phy_addr;
|
data->phy_id = hw->phy_addr;
|
||||||
break;
|
break;
|
||||||
case SIOCGMIIREG:
|
case SIOCGMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
spin_lock_irqsave(&adapter->stats_lock, flags);
|
spin_lock_irqsave(&adapter->stats_lock, flags);
|
||||||
if (e1000_read_phy_reg(hw, data->reg_num & 0x1F,
|
if (e1000_read_phy_reg(hw, data->reg_num & 0x1F,
|
||||||
&data->val_out)) {
|
&data->val_out)) {
|
||||||
|
@ -4725,8 +4723,6 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
|
||||||
spin_unlock_irqrestore(&adapter->stats_lock, flags);
|
spin_unlock_irqrestore(&adapter->stats_lock, flags);
|
||||||
break;
|
break;
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
if (data->reg_num & ~(0x1F))
|
if (data->reg_num & ~(0x1F))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
mii_reg = data->val_in;
|
mii_reg = data->val_in;
|
||||||
|
|
|
@ -4346,8 +4346,6 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
|
||||||
data->phy_id = adapter->hw.phy.addr;
|
data->phy_id = adapter->hw.phy.addr;
|
||||||
break;
|
break;
|
||||||
case SIOCGMIIREG:
|
case SIOCGMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
switch (data->reg_num & 0x1F) {
|
switch (data->reg_num & 0x1F) {
|
||||||
case MII_BMCR:
|
case MII_BMCR:
|
||||||
data->val_out = adapter->phy_regs.bmcr;
|
data->val_out = adapter->phy_regs.bmcr;
|
||||||
|
|
|
@ -2225,8 +2225,6 @@ static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
emac_mdio_write(ndev, dev->phy.address, data[1], data[2]);
|
emac_mdio_write(ndev, dev->phy.address, data[1], data[2]);
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -4914,8 +4914,6 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
|
||||||
data->phy_id = adapter->hw.phy.addr;
|
data->phy_id = adapter->hw.phy.addr;
|
||||||
break;
|
break;
|
||||||
case SIOCGMIIREG:
|
case SIOCGMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
if (igb_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
|
if (igb_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
|
||||||
&data->val_out))
|
&data->val_out))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
|
@ -380,10 +380,7 @@ int mdio_mii_ioctl(const struct mdio_if_info *mdio,
|
||||||
cmd = SIOCGMIIREG;
|
cmd = SIOCGMIIREG;
|
||||||
break;
|
break;
|
||||||
case SIOCGMIIREG:
|
case SIOCGMIIREG:
|
||||||
break;
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
|
@ -433,9 +433,6 @@ int generic_mii_ioctl(struct mii_if_info *mii_if,
|
||||||
case SIOCSMIIREG: {
|
case SIOCSMIIREG: {
|
||||||
u16 val = mii_data->val_in;
|
u16 val = mii_data->val_in;
|
||||||
|
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
if (mii_data->phy_id == mii_if->phy_id) {
|
if (mii_data->phy_id == mii_if->phy_id) {
|
||||||
switch(mii_data->reg_num) {
|
switch(mii_data->reg_num) {
|
||||||
case MII_BMCR: {
|
case MII_BMCR: {
|
||||||
|
|
|
@ -3075,8 +3075,6 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
if (dev->if_port == PORT_TP) {
|
if (dev->if_port == PORT_TP) {
|
||||||
if ((data->phy_id & 0x1f) == np->phy_addr_external) {
|
if ((data->phy_id & 0x1f) == np->phy_addr_external) {
|
||||||
if ((data->reg_num & 0x1f) == MII_ADVERTISE)
|
if ((data->reg_num & 0x1f) == MII_ADVERTISE)
|
||||||
|
|
|
@ -1784,11 +1784,6 @@ static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable (CAP_NET_ADMIN)) {
|
|
||||||
rc = -EPERM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
spin_lock_irqsave (&tp->lock, flags);
|
spin_lock_irqsave (&tp->lock, flags);
|
||||||
mdio_write (dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
|
mdio_write (dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
|
||||||
spin_unlock_irqrestore (&tp->lock, flags);
|
spin_unlock_irqrestore (&tp->lock, flags);
|
||||||
|
|
|
@ -1124,8 +1124,6 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
int saved_window;
|
int saved_window;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
spin_lock_irqsave(&lp->window_lock, flags);
|
spin_lock_irqsave(&lp->window_lock, flags);
|
||||||
saved_window = inw(ioaddr + EL3_CMD) >> 13;
|
saved_window = inw(ioaddr + EL3_CMD) >> 13;
|
||||||
EL3WINDOW(4);
|
EL3WINDOW(4);
|
||||||
|
|
|
@ -706,8 +706,6 @@ static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
|
data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
|
||||||
return 0;
|
return 0;
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
|
mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1204,8 +1204,6 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
|
data[3] = mdio_read(mii_addr, data[0], data[1] & 0x1f);
|
||||||
return 0;
|
return 0;
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
|
mdio_write(mii_addr, data[0], data[1] & 0x1f, data[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1575,8 +1575,6 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
data[3] = mii_rd(ioaddr, data[0] & 0x1f, data[1] & 0x1f);
|
data[3] = mii_rd(ioaddr, data[0] & 0x1f, data[1] & 0x1f);
|
||||||
break;
|
break;
|
||||||
case SIOCSMIIREG: /* Write the specified MII register */
|
case SIOCSMIIREG: /* Write the specified MII register */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
mii_wr(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2], 16);
|
mii_wr(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2], 16);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -324,9 +324,6 @@ int phy_mii_ioctl(struct phy_device *phydev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
if (mii_data->phy_id == phydev->addr) {
|
if (mii_data->phy_id == phydev->addr) {
|
||||||
switch(mii_data->reg_num) {
|
switch(mii_data->reg_num) {
|
||||||
case MII_BMCR:
|
case MII_BMCR:
|
||||||
|
|
|
@ -1991,8 +1991,6 @@ static int rtl_xmii_ioctl(struct rtl8169_private *tp, struct mii_ioctl_data *dat
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
mdio_write(tp->mmio_addr, data->reg_num & 0x1f, data->val_in);
|
mdio_write(tp->mmio_addr, data->reg_num & 0x1f, data->val_in);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2128,8 +2128,6 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
mdio_write(net_dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
|
mdio_write(net_dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -2496,9 +2496,6 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
spin_lock_bh(&hw->phy_lock);
|
spin_lock_bh(&hw->phy_lock);
|
||||||
if (hw->chip_id == CHIP_ID_GENESIS)
|
if (hw->chip_id == CHIP_ID_GENESIS)
|
||||||
err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f,
|
err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f,
|
||||||
|
|
|
@ -1214,9 +1214,6 @@ static int sky2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
spin_lock_bh(&sky2->phy_lock);
|
spin_lock_bh(&sky2->phy_lock);
|
||||||
err = gm_phy_write(hw, sky2->port, data->reg_num & 0x1f,
|
err = gm_phy_write(hw, sky2->port, data->reg_num & 0x1f,
|
||||||
data->val_in);
|
data->val_in);
|
||||||
|
|
|
@ -2852,9 +2852,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
if (!gp->running)
|
||||||
rc = -EPERM;
|
|
||||||
else if (!gp->running)
|
|
||||||
rc = -EAGAIN;
|
rc = -EAGAIN;
|
||||||
else {
|
else {
|
||||||
__phy_write(gp, data->phy_id & 0x1f, data->reg_num & 0x1f,
|
__phy_write(gp, data->phy_id & 0x1f, data->reg_num & 0x1f,
|
||||||
|
|
|
@ -10610,9 +10610,6 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||||
if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)
|
if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)
|
||||||
break; /* We have no PHY */
|
break; /* We have no PHY */
|
||||||
|
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
if (tp->link_config.phy_is_low_power)
|
if (tp->link_config.phy_is_low_power)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
|
|
|
@ -1004,8 +1004,6 @@ static int TLan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
|
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
TLan_MiiWriteReg(dev, data->phy_id & 0x1f,
|
TLan_MiiWriteReg(dev, data->phy_id & 0x1f,
|
||||||
data->reg_num & 0x1f, data->val_in);
|
data->reg_num & 0x1f, data->val_in);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -923,8 +923,6 @@ static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable (CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
if (regnum & ~0x1f)
|
if (regnum & ~0x1f)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (data->phy_id == phy) {
|
if (data->phy_id == phy) {
|
||||||
|
|
|
@ -1470,8 +1470,6 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
spin_lock_irq(&np->lock);
|
spin_lock_irq(&np->lock);
|
||||||
mdio_write(dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
|
mdio_write(dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
|
||||||
spin_unlock_irq(&np->lock);
|
spin_unlock_irq(&np->lock);
|
||||||
|
|
|
@ -2328,14 +2328,10 @@ static int velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd
|
||||||
miidata->phy_id = readb(®s->MIIADR) & 0x1f;
|
miidata->phy_id = readb(®s->MIIADR) & 0x1f;
|
||||||
break;
|
break;
|
||||||
case SIOCGMIIREG:
|
case SIOCGMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
if (velocity_mii_read(vptr->mac_regs, miidata->reg_num & 0x1f, &(miidata->val_out)) < 0)
|
if (velocity_mii_read(vptr->mac_regs, miidata->reg_num & 0x1f, &(miidata->val_out)) < 0)
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
break;
|
break;
|
||||||
case SIOCSMIIREG:
|
case SIOCSMIIREG:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
spin_lock_irqsave(&vptr->lock, flags);
|
spin_lock_irqsave(&vptr->lock, flags);
|
||||||
err = velocity_mii_write(vptr->mac_regs, miidata->reg_num & 0x1f, miidata->val_in);
|
err = velocity_mii_write(vptr->mac_regs, miidata->reg_num & 0x1f, miidata->val_in);
|
||||||
spin_unlock_irqrestore(&vptr->lock, flags);
|
spin_unlock_irqrestore(&vptr->lock, flags);
|
||||||
|
|
|
@ -1365,8 +1365,6 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SIOCSMIIREG: /* Write MII PHY register. */
|
case SIOCSMIIREG: /* Write MII PHY register. */
|
||||||
if (!capable(CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
if (data->phy_id == np->phys[0]) {
|
if (data->phy_id == np->phys[0]) {
|
||||||
u16 value = data->val_in;
|
u16 value = data->val_in;
|
||||||
switch (data->reg_num) {
|
switch (data->reg_num) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче