Patchwork phylib: phy_mii_ioctl() fixes

login
register
mail settings
Submitter Lennert Buytenhek
Date Sept. 18, 2008, 1:06 p.m.
Message ID <20080918130652.GA10552@xi.wantstofly.org>
Download mbox | patch
Permalink /patch/510/
State Accepted
Delegated to: Jeff Garzik
Headers show

Comments

Lennert Buytenhek - Sept. 18, 2008, 1:06 p.m.
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>
Andy Fleming - Sept. 18, 2008, 10:54 p.m.
On Thu, Sep 18, 2008 at 8:06 AM, Lennert Buytenhek
<buytenh@wantstofly.org> wrote:
> 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>

Patch

Index: linux-2.6/drivers/net/phy/phy.c
===================================================================
--- linux-2.6.orig/drivers/net/phy/phy.c
+++ linux-2.6/drivers/net/phy/phy.c
@@ -411,7 +411,8 @@  int phy_mii_ioctl(struct phy_device *phy
 	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;
@@ -458,7 +459,7 @@  int phy_mii_ioctl(struct phy_device *phy
 		break;
 
 	default:
-		return -ENOTTY;
+		return -EOPNOTSUPP;
 	}
 
 	return 0;