On 23-09-20, Sascha Hauer wrote: > Provide phy_set_bits_mmd() and phy_clear_bits() for easier code adoption > from the kernel. > > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> Reviewed-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> > --- > include/linux/phy.h | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/include/linux/phy.h b/include/linux/phy.h > index bb728dfaf8..d68ee5665a 100644 > --- a/include/linux/phy.h > +++ b/include/linux/phy.h > @@ -422,6 +422,34 @@ int phy_modify_mmd(struct phy_device *phydev, int devad, u32 regnum, > int phy_modify_mmd_changed(struct phy_device *phydev, int devad, u32 regnum, > u16 mask, u16 set); > > +/** > + * phy_set_bits_mmd - Convenience function for setting bits in a register > + * on MMD > + * @phydev: the phy_device struct > + * @devad: the MMD containing register to modify > + * @regnum: register number to modify > + * @val: bits to set > + */ > +static inline int phy_set_bits_mmd(struct phy_device *phydev, int devad, > + u32 regnum, u16 val) > +{ > + return phy_modify_mmd(phydev, devad, regnum, 0, val); > +} > + > +/** > + * phy_clear_bits_mmd - Convenience function for clearing bits in a register > + * on MMD > + * @phydev: the phy_device struct > + * @devad: the MMD containing register to modify > + * @regnum: register number to modify > + * @val: bits to clear > + */ > +static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad, > + u32 regnum, u16 val) > +{ > + return phy_modify_mmd(phydev, devad, regnum, val, 0); > +} > + > static inline bool phy_acquired(struct phy_device *phydev) > { > return phydev && phydev->bus && slice_acquired(&phydev->bus->slice); > -- > 2.39.2 > > >