Commit 69c58852 authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by David S. Miller

bgmac: use phy_mii_ioctl in ioctl handler

This works pretty much the same way, so avoid duplicating the code.
Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5322dbf0
......@@ -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;
}
return -EINVAL;
return phy_mii_ioctl(bgmac->phy_dev, ifr, cmd);
}
static const struct net_device_ops bgmac_netdev_ops = {
......
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