phylib: phy_mii_ioctl() fixes
authorLennert Buytenhek <buytenh@wantstofly.org>
Thu, 18 Sep 2008 03:06:52 +0000 (03:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Oct 2008 22:24:56 +0000 (15:24 -0700)
Make the SIOCGMIIPHY case fall through properly (it is supposed
to not only return the ID of the default PHY but also to read from
that PHY), and make phy_mii_ioctl() return the same error code as
generic_mii_ioctl() in case of an unsupported operation.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Acked-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c

index 45cc2914d3475d1f12db6749890158087f7ab6ca..0433fcd009438b65aee19afed77eed75f0bd9e3c 100644 (file)
@@ -366,7 +366,8 @@ int phy_mii_ioctl(struct phy_device *phydev,
        switch (cmd) {
        case SIOCGMIIPHY:
                mii_data->phy_id = phydev->addr;
-               break;
+               /* fall through */
+
        case SIOCGMIIREG:
                mii_data->val_out = phy_read(phydev, mii_data->reg_num);
                break;
@@ -413,7 +414,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
                break;
 
        default:
-               return -ENOTTY;
+               return -EOPNOTSUPP;
        }
 
        return 0;