Add helper inline functions __mdiodev_c45_read() and
__mdiodev_c45_write(), which are the C45 equivalents of the existing
__mdiodev_read() and __mdiodev_write() added by commit e6a45700e7e1
("net: mdio: add unlocked mdiobus and mdiodev bus accessors")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
RFC v4: no changes
RFC v3: no changes
RFC v2: add this patch, initial submission
---
include/linux/mdio.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 42d6d47e445b7..f39b4dba5cd4f 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -648,6 +648,19 @@ static inline int mdiodev_modify_changed(struct mdio_device *mdiodev,
mask, set);
}
+static inline int __mdiodev_c45_read(struct mdio_device *mdiodev, int devad,
+ u16 regnum)
+{
+ return __mdiobus_c45_read(mdiodev->bus, mdiodev->addr, devad, regnum);
+}
+
+static inline int __mdiodev_c45_write(struct mdio_device *mdiodev, u32 devad,
+ u16 regnum, u16 val)
+{
+ return __mdiobus_c45_write(mdiodev->bus, mdiodev->addr, devad, regnum,
+ val);
+}
+
static inline int mdiodev_c45_modify(struct mdio_device *mdiodev, int devad,
u32 regnum, u16 mask, u16 set)
{
--
2.52.0
On Tue, Jan 06, 2026 at 05:14:57PM +0000, Daniel Golle wrote:
> +static inline int __mdiodev_c45_write(struct mdio_device *mdiodev, u32 devad,
> + u16 regnum, u16 val)
> +{
> + return __mdiobus_c45_write(mdiodev->bus, mdiodev->addr, devad, regnum,
> + val);
Something doesn't look right here - missing a couple of spaces to
correctly align? I suspect checkpatch would spot it?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
On Tue, Jan 06, 2026 at 05:53:29PM +0000, Russell King (Oracle) wrote:
> On Tue, Jan 06, 2026 at 05:14:57PM +0000, Daniel Golle wrote:
> > +static inline int __mdiodev_c45_write(struct mdio_device *mdiodev, u32 devad,
> > + u16 regnum, u16 val)
> > +{
> > + return __mdiobus_c45_write(mdiodev->bus, mdiodev->addr, devad, regnum,
> > + val);
>
> Something doesn't look right here - missing a couple of spaces to
> correctly align? I suspect checkpatch would spot it?
Somehow those two spaces got dropped somewhere on the way. Strangely
neither checkpatch.pl locally nor on patchwork[1] caught that -- maybe
because 'return' statements are somehow treated differently?
Anyway, fixed in my local tree now and going to be fixed in v5.
Are you otherwise fine with adding those unlocked mdiodev c45 helpers?
[1]: https://patchwork.kernel.org/project/netdevbpf/patch/36fbca0aaa0ca86450c565190931d987931ab958.1767718090.git.daniel@makrotopia.org/
On Tue, Jan 06, 2026 at 10:36:09PM +0000, Daniel Golle wrote:
> On Tue, Jan 06, 2026 at 05:53:29PM +0000, Russell King (Oracle) wrote:
> > On Tue, Jan 06, 2026 at 05:14:57PM +0000, Daniel Golle wrote:
> > > +static inline int __mdiodev_c45_write(struct mdio_device *mdiodev, u32 devad,
> > > + u16 regnum, u16 val)
> > > +{
> > > + return __mdiobus_c45_write(mdiodev->bus, mdiodev->addr, devad, regnum,
> > > + val);
> >
> > Something doesn't look right here - missing a couple of spaces to
> > correctly align? I suspect checkpatch would spot it?
>
> Somehow those two spaces got dropped somewhere on the way. Strangely
> neither checkpatch.pl locally nor on patchwork[1] caught that -- maybe
> because 'return' statements are somehow treated differently?
>
> Anyway, fixed in my local tree now and going to be fixed in v5.
>
> Are you otherwise fine with adding those unlocked mdiodev c45 helpers?
Yes.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
© 2016 - 2026 Red Hat, Inc.