From: David Daney Date: Fri, 30 Sep 2011 11:51:22 +0000 (+0000) Subject: netdev/phy: Use mdiobus_read() so that proper locks are taken. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6fe3264945ee63292cdfb27b6e95bc52c603bb09;p=openwrt%2Fstaging%2Fblogic.git netdev/phy: Use mdiobus_read() so that proper locks are taken. Accesses to the mdio busses must be done with the mdio_lock to ensure proper operation. Conveniently we have the helper function mdiobus_read() to do that for us. Lets use it in get_phy_id() instead of accessing the bus without the lock held. Signed-off-by: David Daney Signed-off-by: David S. Miller --- diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index ff109fe5af6b..83a5a5afec67 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -213,7 +213,7 @@ int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id) /* Grab the bits from PHYIR1, and put them * in the upper half */ - phy_reg = bus->read(bus, addr, MII_PHYSID1); + phy_reg = mdiobus_read(bus, addr, MII_PHYSID1); if (phy_reg < 0) return -EIO; @@ -221,7 +221,7 @@ int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id) *phy_id = (phy_reg & 0xffff) << 16; /* Grab the bits from PHYIR2, and put them in the lower half */ - phy_reg = bus->read(bus, addr, MII_PHYSID2); + phy_reg = mdiobus_read(bus, addr, MII_PHYSID2); if (phy_reg < 0) return -EIO;