Fix the handling of unsupported ioctls (eth0 appeared in iwconfig for instance)
[openwrt/svn-archive/archive.git] / target / linux / au1000-2.6 / patches / 014-au1000_eth_ioctl.patch
1 diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
2 index c27cfce..99a1c61 100644
3 --- a/drivers/net/au1000_eth.c
4 +++ b/drivers/net/au1000_eth.c
5 @@ -1316,12 +1316,20 @@ static void set_rx_mode(struct net_device *dev)
6 static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
7 {
8 struct au1000_private *aup = (struct au1000_private *)dev->priv;
9 + struct mii_ioctl_data *data = if_mii(rq);
10 + int rc = -EOPNOTSUPP;
11
12 if (!netif_running(dev)) return -EINVAL;
13
14 if (!aup->phy_dev) return -EINVAL; // PHY not controllable
15
16 - return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
17 + switch (cmd) {
18 + default:
19 + rc = phy_mii_ioctl(aup->phy_dev, data, cmd);
20 + break;
21 + }
22 +
23 + return rc;
24 }
25
26 static struct net_device_stats *au1000_get_stats(struct net_device *dev)