Skip to content

Commit

Permalink
netdev/phy: Use mdiobus_read() so that proper locks are taken.
Browse files Browse the repository at this point in the history
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 <david.daney@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Daney authored and David S. Miller committed Sep 30, 2011
1 parent 8e00f5f commit 6fe3264
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ 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;

*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;
Expand Down

0 comments on commit 6fe3264

Please sign in to comment.