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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 11 Feb 2022 09:35:01 +0000
From:   Alvin Šipraga <ALSI@...g-olufsen.dk>
To:     Luiz Angelo Daros de Luca <luizluca@...il.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
        "andrew@...n.ch" <andrew@...n.ch>,
        "vivien.didelot@...il.com" <vivien.didelot@...il.com>,
        "f.fainelli@...il.com" <f.fainelli@...il.com>,
        "olteanv@...il.com" <olteanv@...il.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "arinc.unal@...nc9.com" <arinc.unal@...nc9.com>
Subject: Re: [PATCH net-next] net: dsa: OF-ware slave_mii_bus (RFC)

Luiz Angelo Daros de Luca <luizluca@...il.com> writes:

> If found, register the DSA internal allocated slave_mii_bus with an OF
> "mdio" child object. It can save some drivers from creating their
> internal MDIO bus.
>
> Some doubts:
> 1) is there any special reason for the absence of a "device_node dn" in
>    dsa_switch? Is there any constraint on where to place it?
> 2) Is looking for "mdio" the best solution?
>
> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@...il.com>
> ---
>  include/net/dsa.h | 2 ++
>  net/dsa/dsa2.c    | 8 +++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index b688ced04b0e..c01c059c5335 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -421,6 +421,8 @@ struct dsa_switch {
>  	u32			phys_mii_mask;
>  	struct mii_bus		*slave_mii_bus;
>  
> +	struct device_node	*dn;
> +
>  	/* Ageing Time limits in msecs */
>  	unsigned int ageing_time_min;
>  	unsigned int ageing_time_max;
> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> index 909b045c9b11..db1aeb6b8352 100644
> --- a/net/dsa/dsa2.c
> +++ b/net/dsa/dsa2.c
> @@ -13,6 +13,7 @@
>  #include <linux/slab.h>
>  #include <linux/rtnetlink.h>
>  #include <linux/of.h>
> +#include <linux/of_mdio.h>
>  #include <linux/of_net.h>
>  #include <net/devlink.h>
>  #include <net/sch_generic.h>
> @@ -869,6 +870,7 @@ static int dsa_switch_setup_tag_protocol(struct dsa_switch *ds)
>  static int dsa_switch_setup(struct dsa_switch *ds)
>  {
>  	struct dsa_devlink_priv *dl_priv;
> +	struct device_node *dn;
>  	struct dsa_port *dp;
>  	int err;
>  
> @@ -924,7 +926,9 @@ static int dsa_switch_setup(struct dsa_switch *ds)
>  
>  		dsa_slave_mii_bus_init(ds);
>  
> -		err = mdiobus_register(ds->slave_mii_bus);
> +		dn = of_get_child_by_name(ds->dn, "mdio");

of_node_put(dn) after registration? Or else who will put it?

> +
> +		err = of_mdiobus_register(ds->slave_mii_bus, dn);
>  		if (err < 0)
>  			goto free_slave_mii_bus;
>  	}
> @@ -1610,6 +1614,8 @@ static int dsa_switch_parse_of(struct dsa_switch *ds, struct device_node *dn)
>  {
>  	int err;
>  
> +	ds->dn = dn;
> +
>  	err = dsa_switch_parse_member_of(ds, dn);
>  	if (err)
>  		return err;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ