diff options
Diffstat (limited to 'drivers/net/phy/phy-core.c')
-rw-r--r-- | drivers/net/phy/phy-core.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 48e762bf6464..44d09b192014 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c | |||
@@ -349,6 +349,29 @@ int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) | |||
349 | } | 349 | } |
350 | EXPORT_SYMBOL_GPL(__phy_modify); | 350 | EXPORT_SYMBOL_GPL(__phy_modify); |
351 | 351 | ||
352 | /** | ||
353 | * phy_modify - Convenience function for modifying a given PHY register | ||
354 | * @phydev: the phy_device struct | ||
355 | * @regnum: register number to write | ||
356 | * @mask: bit mask of bits to clear | ||
357 | * @set: new value of bits set in mask to write to @regnum | ||
358 | * | ||
359 | * NOTE: MUST NOT be called from interrupt context, | ||
360 | * because the bus read/write functions may wait for an interrupt | ||
361 | * to conclude the operation. | ||
362 | */ | ||
363 | int phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) | ||
364 | { | ||
365 | int ret; | ||
366 | |||
367 | mutex_lock(&phydev->mdio.bus->mdio_lock); | ||
368 | ret = __phy_modify(phydev, regnum, mask, set); | ||
369 | mutex_unlock(&phydev->mdio.bus->mdio_lock); | ||
370 | |||
371 | return ret; | ||
372 | } | ||
373 | EXPORT_SYMBOL_GPL(phy_modify); | ||
374 | |||
352 | static int __phy_read_page(struct phy_device *phydev) | 375 | static int __phy_read_page(struct phy_device *phydev) |
353 | { | 376 | { |
354 | return phydev->drv->read_page(phydev); | 377 | return phydev->drv->read_page(phydev); |