[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3b0399d3535ba2546274733c3adb5266adc31094.camel@siemens.com>
Date: Tue, 26 Aug 2025 07:30:04 +0000
From: "Sverdlin, Alexander" <alexander.sverdlin@...mens.com>
To: "hauke@...ke-m.de" <hauke@...ke-m.de>, "olteanv@...il.com"
<olteanv@...il.com>, "davem@...emloft.net" <davem@...emloft.net>,
"andrew@...n.ch" <andrew@...n.ch>, "linux@...linux.org.uk"
<linux@...linux.org.uk>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "daniel@...rotopia.org"
<daniel@...rotopia.org>, "kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>, "edumazet@...gle.com"
<edumazet@...gle.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "john@...ozen.org" <john@...ozen.org>, "Stockmann, Lukas"
<lukas.stockmann@...mens.com>, "yweng@...linear.com" <yweng@...linear.com>,
"fchan@...linear.com" <fchan@...linear.com>, "lxu@...linear.com"
<lxu@...linear.com>, "jpovazanec@...linear.com" <jpovazanec@...linear.com>,
"Schirm, Andreas" <andreas.schirm@...mens.com>, "Christen, Peter"
<peter.christen@...mens.com>, "ajayaraman@...linear.com"
<ajayaraman@...linear.com>, "bxu@...linear.com" <bxu@...linear.com>,
"lrosu@...linear.com" <lrosu@...linear.com>
Subject: Re: [PATCH net-next 6/6] net: dsa: lantiq_gswip: move MDIO bus
registration to .setup()
Hi!
On Tue, 2025-08-26 at 01:14 +0100, Daniel Golle wrote:
> Instead of registering the switch MDIO bus in the probe() function, move
> the call to gswip_mdio() into the .setup() DSA switch op, so it can be
> reused independently of the probe() function.
>
> Signed-off-by: Daniel Golle <daniel@...rotopia.org>
> ---
> drivers/net/dsa/lantiq_gswip.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
> index 23b68047f3c4..9ec262ec3a11 100644
> --- a/drivers/net/dsa/lantiq_gswip.c
> +++ b/drivers/net/dsa/lantiq_gswip.c
> @@ -627,6 +627,13 @@ static int gswip_setup(struct dsa_switch *ds)
> /* Configure the MDIO Clock 2.5 MHz */
> gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1);
>
> + /* bring up the mdio bus */
> + err = gswip_mdio(priv);
> + if (err) {
> + dev_err(priv->dev, "mdio bus setup failed\n");
> + return err;
> + }
> +
> /* Disable the xMII interface and clear it's isolation bit */
> for (i = 0; i < priv->hw_info->max_ports; i++)
> gswip_mii_mask_cfg(priv,
> @@ -1973,13 +1980,6 @@ static int gswip_probe(struct platform_device *pdev)
> "gphy fw probe failed\n");
> }
>
> - /* bring up the mdio bus */
> - err = gswip_mdio(priv);
> - if (err) {
> - dev_err_probe(dev, err, "mdio probe failed\n");
> - goto gphy_fw_remove;
> - }
> -
> err = dsa_register_switch(priv->ds);
> if (err) {
> dev_err_probe(dev, err, "dsa switch registration failed\n");
Moving to .setup callback makes sense to me in general, but isn't a
.teardown callback necessary as well to de-register the bus?
Maybe the resource-managed devm_mdiobus_alloc() and devm_of_mdiobus_register()
have to be downgraded to their corresponding non-managed variants?
--
Alexander Sverdlin
Siemens AG
www.siemens.com
Powered by blists - more mailing lists