
On 20. 04. 20 20:53, Dan Murphy wrote:
Add phy_set/clear_bit helper routines so that ported drivers from the kernel can use these functions.
Signed-off-by: Dan Murphy dmurphy@ti.com
include/phy.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
diff --git a/include/phy.h b/include/phy.h index b5de14cbfc29..050c989fa537 100644 --- a/include/phy.h +++ b/include/phy.h @@ -257,6 +257,44 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad, return phy_write(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA, val); }
kernel-doc description would be good.
+static inline int phy_set_bits_mmd(struct phy_device *phydev, int devad,
u32 regnum, u16 val)
+{
- int value;
- int ret;
nit: on one line should be better.
- value = phy_read_mmd(phydev, devad, regnum);
- if (value < 0)
return value;
- value |= val;
- ret = phy_write_mmd(phydev, devad, regnum, value);
- if (ret < 0)
return ret;
- return 0;
+}
+static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
u32 regnum, u16 val)
+{
- int value;
- int ret;
ditto.
- value = phy_read_mmd(phydev, devad, regnum);
- if (value < 0)
return value;
- value &= ~val;
- ret = phy_write_mmd(phydev, devad, regnum, value);
- if (ret < 0)
return ret;
- return 0;
+}
#ifdef CONFIG_PHYLIB_10G extern struct phy_driver gen10g_driver;
Thanks, Michal