public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Jose Abreu <Jose.Abreu@synopsys.com>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next 1/3] net: dsa: sja1105: allow XPCS to handle mdiodev lifetime
Date: Fri, 2 Jun 2023 17:30:20 +0300	[thread overview]
Message-ID: <20230602143020.w7czsg5ldqpkqhep@skbuf> (raw)
In-Reply-To: <E1q55IZ-00Bp4w-6V@rmk-PC.armlinux.org.uk>

On Fri, Jun 02, 2023 at 02:58:35PM +0100, Russell King (Oracle) wrote:
> Put the mdiodev after xpcs_create() so that the XPCS driver can manage
> the lifetime of the mdiodev its using.

nitpick: "it's using"

> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/dsa/sja1105/sja1105_mdio.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
> index 01f1cb719042..166fe747f70a 100644
> --- a/drivers/net/dsa/sja1105/sja1105_mdio.c
> +++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
> @@ -417,6 +417,7 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
>  		}
>  
>  		xpcs = xpcs_create(mdiodev, priv->phy_mode[port]);
> +		mdio_device_put(mdiodev);
>  		if (IS_ERR(xpcs)) {
>  			rc = PTR_ERR(xpcs);
>  			goto out_pcs_free;
> @@ -434,7 +435,6 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
>  		if (!priv->xpcs[port])
>  			continue;
>  
> -		mdio_device_free(priv->xpcs[port]->mdiodev);
>  		xpcs_destroy(priv->xpcs[port]);
>  		priv->xpcs[port] = NULL;
>  	}
> @@ -457,7 +457,6 @@ static void sja1105_mdiobus_pcs_unregister(struct sja1105_private *priv)
>  		if (!priv->xpcs[port])
>  			continue;
>  
> -		mdio_device_free(priv->xpcs[port]->mdiodev);
>  		xpcs_destroy(priv->xpcs[port]);
>  		priv->xpcs[port] = NULL;
>  	}
> -- 
> 2.30.2
> 

So before this patch, sja1105 was using xpcs with an mdiodev refcount
of 2 (a transition phase after commit 9a5d500cffdb ("net: pcs: xpcs: add
xpcs_create_mdiodev()")), and now it's back to using it with a refcount
of 1? okay.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>

  reply	other threads:[~2023-06-02 14:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 13:58 [PATCH net-next 0/3] convert sja1105 xpcs creation and remove xpcs_create Russell King (Oracle)
2023-06-02 13:58 ` [PATCH net-next 1/3] net: dsa: sja1105: allow XPCS to handle mdiodev lifetime Russell King (Oracle)
2023-06-02 14:30   ` Vladimir Oltean [this message]
2023-06-02 14:44     ` Russell King (Oracle)
2023-06-02 13:58 ` [PATCH net-next 2/3] net: dsa: sja1105: use xpcs_create_mdiodev() Russell King (Oracle)
2023-06-02 14:30   ` Vladimir Oltean
2023-06-02 13:58 ` [PATCH net-next 3/3] net: pcs: xpcs: remove xpcs_create() from public view Russell King (Oracle)
2023-06-02 14:31   ` Vladimir Oltean
2023-06-05 10:30 ` [PATCH net-next 0/3] convert sja1105 xpcs creation and remove xpcs_create patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230602143020.w7czsg5ldqpkqhep@skbuf \
    --to=olteanv@gmail.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox