aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2018-01-02 05:58:37 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-03 11:00:22 -0500
commit788f9933db6172801336d0ae2dec5bdc7525389f (patch)
treebff7e4db796bc371b4f597bb8958e3391637cf0d /include/linux
parent1b2dea2e6a6e3399e88784d57aea80f4fd5e8956 (diff)
net: phy: add unlocked accessors
Add unlocked versions of the bus accessors, which allows access to the bus with all the tracing. These accessors validate that the bus mutex is held, which is a basic requirement for all mii bus accesses. Also added is a read-modify-write unlocked accessor with the same locking requirements. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/phy.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index a052e3768422..0c5a28520c65 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -718,6 +718,18 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum)
718} 718}
719 719
720/** 720/**
721 * __phy_read - convenience function for reading a given PHY register
722 * @phydev: the phy_device struct
723 * @regnum: register number to read
724 *
725 * The caller must have taken the MDIO bus lock.
726 */
727static inline int __phy_read(struct phy_device *phydev, u32 regnum)
728{
729 return __mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum);
730}
731
732/**
721 * phy_write - Convenience function for writing a given PHY register 733 * phy_write - Convenience function for writing a given PHY register
722 * @phydev: the phy_device struct 734 * @phydev: the phy_device struct
723 * @regnum: register number to write 735 * @regnum: register number to write
@@ -733,6 +745,22 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
733} 745}
734 746
735/** 747/**
748 * __phy_write - Convenience function for writing a given PHY register
749 * @phydev: the phy_device struct
750 * @regnum: register number to write
751 * @val: value to write to @regnum
752 *
753 * The caller must have taken the MDIO bus lock.
754 */
755static inline int __phy_write(struct phy_device *phydev, u32 regnum, u16 val)
756{
757 return __mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum,
758 val);
759}
760
761int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set);
762
763/**
736 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq 764 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
737 * @phydev: the phy_device struct 765 * @phydev: the phy_device struct
738 * 766 *