All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, andrew@lunn.ch
Subject: Re: [PATCH net-next] phylink: add ASSERT_RTNL() on phylink connect functions
Date: Wed, 23 Oct 2019 14:10:32 +0100	[thread overview]
Message-ID: <20191023131032.GZ25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <1571833940-26250-1-git-send-email-ioana.ciornei@nxp.com>

On Wed, Oct 23, 2019 at 03:32:20PM +0300, Ioana Ciornei wrote:
> The appropriate assert on the rtnl lock is not present in phylink's
> connect functions which makes unusual calls to them not to be catched.
> Add the appropriate ASSERT_RTNL().

As I previously replied, this is not necessary.  It is safe to attach
PHYs _prior_ to the netdev being registered without taking the rtnl
lock, just like phylib's phy_connect()/phy_attach() are safe.

> 
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> ---
>  drivers/net/phy/phylink.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index be7a2c0fa59b..d0aa0c861b2d 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -786,6 +786,8 @@ static int __phylink_connect_phy(struct phylink *pl, struct phy_device *phy,
>   */
>  int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
>  {
> +	ASSERT_RTNL();
> +
>  	/* Use PHY device/driver interface */
>  	if (pl->link_interface == PHY_INTERFACE_MODE_NA) {
>  		pl->link_interface = phy->interface;
> @@ -815,6 +817,8 @@ int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn,
>  	struct phy_device *phy_dev;
>  	int ret;
>  
> +	ASSERT_RTNL();
> +
>  	/* Fixed links and 802.3z are handled without needing a PHY */
>  	if (pl->link_an_mode == MLO_AN_FIXED ||
>  	    (pl->link_an_mode == MLO_AN_INBAND &&
> -- 
> 1.9.1
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

  reply	other threads:[~2019-10-23 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 12:32 [PATCH net-next] phylink: add ASSERT_RTNL() on phylink connect functions Ioana Ciornei
2019-10-23 13:10 ` Russell King - ARM Linux admin [this message]
2019-10-23 15:59   ` Ioana Ciornei

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=20191023131032.GZ25745@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=ioana.ciornei@nxp.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.