[PATCH net-next] net: sparx5/lan969x: populate netdev of_node

Robert Marko robert.marko at sartura.hr
Mon Nov 10 04:37:08 PST 2025


On Mon, Nov 10, 2025 at 7:57 AM Daniel Machon
<daniel.machon at microchip.com> wrote:
>
> Hi Robert,
>
> > Populate of_node for the port netdevs, to make the individual ports
> > of_nodes available in sysfs.
>
> Sounds reasonable :-)
>
> >
> > Signed-off-by: Robert Marko <robert.marko at sartura.hr>
> > ---
> >  drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
> > index 1d34af78166a..284596f1da04 100644
> > --- a/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
> > +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
> > @@ -300,7 +300,11 @@ int sparx5_register_netdevs(struct sparx5 *sparx5)
> >
> >         for (portno = 0; portno < sparx5->data->consts->n_ports; portno++)
> >                 if (sparx5->ports[portno]) {
> > -                       err = register_netdev(sparx5->ports[portno]->ndev);
> > +                       struct net_device *port_ndev = sparx5->ports[portno]->ndev;
>
> This line exceeds 80 chars and can easily be wrapped.
>
> > +
> > +                       port_ndev->dev.of_node = sparx5->ports[portno]->of_node;
> > +
> > +                       err = register_netdev(port_ndev);
> >                         if (err) {
> >                                 dev_err(sparx5->dev,
> >                                         "port: %02u: netdev registration failed\n",
> > --
> > 2.51.1
> >
>
> It seems wrong to me to stuff this into sparx5_register_netdevs() - there are
> two better candidates, either: sparx5_create_netdev (where other ndev variables
> are assigned) or sparx5_create_port().


Yeah, I indeed overcomplicated this compared to setting it directly in
sparx5_create_port().
I will update this in v2.

Regards,
Robert
>
>
> /Daniel



-- 
Robert Marko
Staff Embedded Linux Engineer
Sartura d.d.
Lendavska ulica 16a
10000 Zagreb, Croatia
Email: robert.marko at sartura.hr
Web: www.sartura.hr



More information about the linux-arm-kernel mailing list