Commit f6807514 authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: converting et131x_ioctl to use phy_mii_ioctl

Handing over ioctls handled by the driver to the phydev.
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 303dfbf5
...@@ -207,47 +207,6 @@ int et131x_close(struct net_device *netdev) ...@@ -207,47 +207,6 @@ int et131x_close(struct net_device *netdev)
return 0; return 0;
} }
/**
* et131x_ioctl_mii - The function which handles MII IOCTLs
* @netdev: device on which the query is being made
* @reqbuf: the request-specific data buffer
* @cmd: the command request code
*
* Returns 0 on success, errno on failure (as defined in errno.h)
*/
int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
{
int status = 0;
struct et131x_adapter *adapter = netdev_priv(netdev);
struct mii_ioctl_data *data = if_mii(reqbuf);
switch (cmd) {
case SIOCGMIIPHY:
data->phy_id = adapter->stats.xcvr_addr;
break;
case SIOCGMIIREG:
if (!capable(CAP_NET_ADMIN))
status = -EPERM;
else
status = et131x_mii_read(adapter,
data->reg_num, &data->val_out);
break;
case SIOCSMIIREG:
if (!capable(CAP_NET_ADMIN))
status = -EPERM;
else
status = et131x_mii_write(adapter, data->reg_num,
data->val_in);
break;
default:
status = -EOPNOTSUPP;
}
return status;
}
/** /**
* et131x_ioctl - The I/O Control handler for the driver * et131x_ioctl - The I/O Control handler for the driver
* @netdev: device on which the control request is being made * @netdev: device on which the control request is being made
...@@ -258,19 +217,12 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd) ...@@ -258,19 +217,12 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
*/ */
int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
{ {
int status = 0; struct et131x_adapter *adapter = netdev_priv(netdev);
switch (cmd) { if (!adapter->phydev)
case SIOCGMIIPHY: return -EINVAL;
case SIOCGMIIREG:
case SIOCSMIIREG:
status = et131x_ioctl_mii(netdev, reqbuf, cmd);
break;
default: return phy_mii_ioctl(adapter->phydev, reqbuf, cmd);
status = -EOPNOTSUPP;
}
return status;
} }
/** /**
......
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