lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240311110318.GN3735877@ragnatech.se>
Date: Mon, 11 Mar 2024 12:03:18 +0100
From: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Sergey Shtylyov <s.shtylyov@....ru>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Rob Herring <robh+dt@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Claudiu Beznea <claudiu.beznea.uj@...renesas.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
	Biju Das <biju.das.jz@...renesas.com>, netdev@...r.kernel.org,
	devicetree@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [net-next 2/2] ravb: Add support for an optional MDIO mode

Hi Geert,

Thanks for your suggestion.

On 2024-03-11 10:32:35 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Sat, Mar 9, 2024 at 4:55 PM Niklas Söderlund
> <niklas.soderlund+renesas@...natech.se> wrote:
> > The driver used the OF node of the device itself when registering the
> > MDIO bus. While this works it creates a problem, it forces any MDIO bus
> > properties to also be set on the devices OF node. This mixes the
> > properties of two distinctly different things and is confusing.
> >
> > This change adds support for an optional mdio node to be defined as a
> > child to the device OF node. The child node can then be used to describe
> > MDIO bus properties that the MDIO core can act on when registering the
> > bus.
> >
> > If no mdio child node is found the driver fallback to the old behavior
> > and register the MDIO bus using the device OF node. This change is
> > backward compatible with old bindings in use.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
> 
> Thanks for your patch!
> 
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -2582,8 +2583,20 @@ static int ravb_mdio_init(struct ravb_private *priv)
> >         snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
> >                  pdev->name, pdev->id);
> >
> > -       /* Register MDIO bus */
> > -       error = of_mdiobus_register(priv->mii_bus, dev->of_node);
> > +       /* Register MDIO bus
> > +        *
> > +        * Look for a mdio child node, if it exist use it when registering the
> > +        * MDIO bus. If no node is found fallback to old behavior and use the
> > +        * device OF node. This is used to be able to describe MDIO bus
> > +        * properties that are consumed when registering the MDIO bus.
> > +        */
> > +       mdio_node = of_get_child_by_name(dev->of_node, "mdio");
> > +       if (mdio_node) {
> > +               error = of_mdiobus_register(priv->mii_bus, mdio_node);
> > +               of_node_put(mdio_node);
> > +       } else {
> > +               error = of_mdiobus_register(priv->mii_bus, dev->of_node);
> > +       }
> >         if (error)
> >                 goto out_free_bus;
> >
> 
> Perhaps the code should be streamlined for the modern case?
> 
>         mdio_node = of_get_child_by_name(dev->of_node, "mdio");
>         if (!mdio_node) {
>                 /* backwards compatibility for DT lacking mdio subnode */
>                 mdio_node = of_node_get(dev->of_node);
>         }
> 
>         error = of_mdiobus_register(priv->mii_bus, mdio_node);
>         of_node_put(mdio_node);
> 
> When deemed necessary, you can easily replace the backwards
> compatibility handling by error handling later.

This looks much better, will do so as well as s/OF/DT/ in the commit 
message for next version.

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

-- 
Kind Regards,
Niklas Söderlund

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ