bgmac: use phy_mii_ioctl in ioctl handler

This works pretty much the same way, so avoid duplicating the code.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Hauke Mehrtens 2013-12-20 15:34:45 +01:00 committed by David S. Miller
parent 5322dbf00a
commit 69c588529d

View File

@ -1198,27 +1198,11 @@ static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
{
struct bgmac *bgmac = netdev_priv(net_dev);
struct mii_ioctl_data *data = if_mii(ifr);
switch (cmd) {
case SIOCGMIIPHY:
data->phy_id = bgmac->phyaddr;
/* fallthru */
case SIOCGMIIREG:
if (!netif_running(net_dev))
return -EAGAIN;
data->val_out = bgmac_phy_read(bgmac, data->phy_id,
data->reg_num & 0x1f);
return 0;
case SIOCSMIIREG:
if (!netif_running(net_dev))
return -EAGAIN;
bgmac_phy_write(bgmac, data->phy_id, data->reg_num & 0x1f,
data->val_in);
return 0;
default:
return -EOPNOTSUPP;
}
if (!netif_running(net_dev))
return -EINVAL;
return phy_mii_ioctl(bgmac->phy_dev, ifr, cmd);
}
static const struct net_device_ops bgmac_netdev_ops = {