* [PATCH net-next 0/3] convert sja1105 xpcs creation and remove xpcs_create
@ 2023-06-02 13:58 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)
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2023-06-02 13:58 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Florian Fainelli, Jakub Kicinski,
Jose Abreu, netdev, Paolo Abeni, Vladimir Oltean
Hi,
This series of three patches converts sja1105 to use the newly
provided xpcs_create_mdiodev(), and as there become no users of
xpcs_create(), removes this function from the global namespace to
discourage future direct use.
drivers/net/dsa/sja1105/sja1105_mdio.c | 11 +----------
drivers/net/pcs/pcs-xpcs.c | 5 ++---
include/linux/pcs/pcs-xpcs.h | 2 --
3 files changed, 3 insertions(+), 15 deletions(-)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net-next 1/3] net: dsa: sja1105: allow XPCS to handle mdiodev lifetime
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 ` Russell King (Oracle)
2023-06-02 14:30 ` Vladimir Oltean
2023-06-02 13:58 ` [PATCH net-next 2/3] net: dsa: sja1105: use xpcs_create_mdiodev() Russell King (Oracle)
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Russell King (Oracle) @ 2023-06-02 13:58 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Florian Fainelli, Jakub Kicinski,
Jose Abreu, netdev, Paolo Abeni, Vladimir Oltean
Put the mdiodev after xpcs_create() so that the XPCS driver can manage
the lifetime of the mdiodev its 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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 2/3] net: dsa: sja1105: use xpcs_create_mdiodev()
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 13:58 ` 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-05 10:30 ` [PATCH net-next 0/3] convert sja1105 xpcs creation and remove xpcs_create patchwork-bot+netdevbpf
3 siblings, 1 reply; 9+ messages in thread
From: Russell King (Oracle) @ 2023-06-02 13:58 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Florian Fainelli, Jakub Kicinski,
Jose Abreu, netdev, Paolo Abeni, Vladimir Oltean
Use the new xpcs_create_mdiodev() creator, which simplifies the
creation and destruction of the mdio device associated with xpcs.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/dsa/sja1105/sja1105_mdio.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
index 166fe747f70a..833e55e4b961 100644
--- a/drivers/net/dsa/sja1105/sja1105_mdio.c
+++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
@@ -400,7 +400,6 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
}
for (port = 0; port < ds->num_ports; port++) {
- struct mdio_device *mdiodev;
struct dw_xpcs *xpcs;
if (dsa_is_unused_port(ds, port))
@@ -410,14 +409,7 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv)
priv->phy_mode[port] != PHY_INTERFACE_MODE_2500BASEX)
continue;
- mdiodev = mdio_device_create(bus, port);
- if (IS_ERR(mdiodev)) {
- rc = PTR_ERR(mdiodev);
- goto out_pcs_free;
- }
-
- xpcs = xpcs_create(mdiodev, priv->phy_mode[port]);
- mdio_device_put(mdiodev);
+ xpcs = xpcs_create_mdiodev(bus, port, priv->phy_mode[port]);
if (IS_ERR(xpcs)) {
rc = PTR_ERR(xpcs);
goto out_pcs_free;
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net-next 3/3] net: pcs: xpcs: remove xpcs_create() from public view
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 13:58 ` [PATCH net-next 2/3] net: dsa: sja1105: use xpcs_create_mdiodev() Russell King (Oracle)
@ 2023-06-02 13:58 ` 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
3 siblings, 1 reply; 9+ messages in thread
From: Russell King (Oracle) @ 2023-06-02 13:58 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Florian Fainelli, Jakub Kicinski,
Jose Abreu, netdev, Paolo Abeni, Vladimir Oltean
There are now no callers of xpcs_create(), so let's remove it from
public view to discourage future direct usage.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/pcs/pcs-xpcs.c | 5 ++---
include/linux/pcs/pcs-xpcs.h | 2 --
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index 1ba214429e01..23223f0f8cad 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -1224,8 +1224,8 @@ static const struct phylink_pcs_ops xpcs_phylink_ops = {
.pcs_link_up = xpcs_link_up,
};
-struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
- phy_interface_t interface)
+static struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
+ phy_interface_t interface)
{
struct dw_xpcs *xpcs;
u32 xpcs_id;
@@ -1273,7 +1273,6 @@ struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
return ERR_PTR(ret);
}
-EXPORT_SYMBOL_GPL(xpcs_create);
void xpcs_destroy(struct dw_xpcs *xpcs)
{
diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h
index a99972a6d046..914e387d5387 100644
--- a/include/linux/pcs/pcs-xpcs.h
+++ b/include/linux/pcs/pcs-xpcs.h
@@ -35,8 +35,6 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces);
int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
int enable);
-struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
- phy_interface_t interface);
struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr,
phy_interface_t interface);
void xpcs_destroy(struct dw_xpcs *xpcs);
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 1/3] net: dsa: sja1105: allow XPCS to handle mdiodev lifetime
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
2023-06-02 14:44 ` Russell King (Oracle)
0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Oltean @ 2023-06-02 14:30 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
Florian Fainelli, Jakub Kicinski, Jose Abreu, netdev, Paolo Abeni
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 2/3] net: dsa: sja1105: use xpcs_create_mdiodev()
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
0 siblings, 0 replies; 9+ messages in thread
From: Vladimir Oltean @ 2023-06-02 14:30 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
Florian Fainelli, Jakub Kicinski, Jose Abreu, netdev, Paolo Abeni
On Fri, Jun 02, 2023 at 02:58:40PM +0100, Russell King (Oracle) wrote:
> Use the new xpcs_create_mdiodev() creator, which simplifies the
> creation and destruction of the mdio device associated with xpcs.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 3/3] net: pcs: xpcs: remove xpcs_create() from public view
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
0 siblings, 0 replies; 9+ messages in thread
From: Vladimir Oltean @ 2023-06-02 14:31 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
Florian Fainelli, Jakub Kicinski, Jose Abreu, netdev, Paolo Abeni
On Fri, Jun 02, 2023 at 02:58:45PM +0100, Russell King (Oracle) wrote:
> There are now no callers of xpcs_create(), so let's remove it from
> public view to discourage future direct usage.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 1/3] net: dsa: sja1105: allow XPCS to handle mdiodev lifetime
2023-06-02 14:30 ` Vladimir Oltean
@ 2023-06-02 14:44 ` Russell King (Oracle)
0 siblings, 0 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2023-06-02 14:44 UTC (permalink / raw)
To: Vladimir Oltean
Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
Florian Fainelli, Jakub Kicinski, Jose Abreu, netdev, Paolo Abeni
On Fri, Jun 02, 2023 at 05:30:20PM +0300, Vladimir Oltean wrote:
> 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.
Absolutely correct, but the key thing is the owners of the refcount(s)
on the object have changed.
> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next 0/3] convert sja1105 xpcs creation and remove xpcs_create
2023-06-02 13:58 [PATCH net-next 0/3] convert sja1105 xpcs creation and remove xpcs_create Russell King (Oracle)
` (2 preceding siblings ...)
2023-06-02 13:58 ` [PATCH net-next 3/3] net: pcs: xpcs: remove xpcs_create() from public view Russell King (Oracle)
@ 2023-06-05 10:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-05 10:30 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, davem, edumazet, f.fainelli, kuba, Jose.Abreu,
netdev, pabeni, olteanv
Hello:
This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Fri, 2 Jun 2023 14:58:09 +0100 you wrote:
> Hi,
>
> This series of three patches converts sja1105 to use the newly
> provided xpcs_create_mdiodev(), and as there become no users of
> xpcs_create(), removes this function from the global namespace to
> discourage future direct use.
>
> [...]
Here is the summary with links:
- [net-next,1/3] net: dsa: sja1105: allow XPCS to handle mdiodev lifetime
https://git.kernel.org/netdev/net-next/c/9607eaadba68
- [net-next,2/3] net: dsa: sja1105: use xpcs_create_mdiodev()
https://git.kernel.org/netdev/net-next/c/bf9a17b04c85
- [net-next,3/3] net: pcs: xpcs: remove xpcs_create() from public view
https://git.kernel.org/netdev/net-next/c/4739b9f3d211
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-06-05 10:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).