提交 6fe32649 编写于 作者: D David Daney 提交者: David S. Miller

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: NDavid Daney <david.daney@cavium.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8e00f5fb
...@@ -213,7 +213,7 @@ int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id) ...@@ -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 /* Grab the bits from PHYIR1, and put them
* in the upper half */ * in the upper half */
phy_reg = bus->read(bus, addr, MII_PHYSID1); phy_reg = mdiobus_read(bus, addr, MII_PHYSID1);
if (phy_reg < 0) if (phy_reg < 0)
return -EIO; return -EIO;
...@@ -221,7 +221,7 @@ int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id) ...@@ -221,7 +221,7 @@ int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id)
*phy_id = (phy_reg & 0xffff) << 16; *phy_id = (phy_reg & 0xffff) << 16;
/* Grab the bits from PHYIR2, and put them in the lower half */ /* 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) if (phy_reg < 0)
return -EIO; return -EIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册