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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 11 Feb 2022 02:11:41 -0300 From: Luiz Angelo Daros de Luca <luizluca@...il.com> To: netdev@...r.kernel.org Cc: linus.walleij@...aro.org, andrew@...n.ch, vivien.didelot@...il.com, f.fainelli@...il.com, olteanv@...il.com, davem@...emloft.net, kuba@...nel.org, alsi@...g-olufsen.dk, arinc.unal@...nc9.com, Luiz Angelo Daros de Luca <luizluca@...il.com> Subject: [PATCH net-next] net: dsa: OF-ware slave_mii_bus (RFC) 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"); + + 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; -- 2.35.1
Powered by blists - more mailing lists