Linux USB
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, max.schulze@online.de,
	khalasa@piap.pl, o.rempel@pengutronix.de,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, imx@lists.linux.dev,
	jun.li@nxp.com
Subject: Re: [PATCH] net: usb: asix: avoid to call phylink_stop() a second time
Date: Fri, 15 Aug 2025 14:59:12 +0200	[thread overview]
Message-ID: <1c352c2f-c8b3-4cbe-9921-8ba5f0e4b433@lunn.ch> (raw)
In-Reply-To: <c3e7m63qcff6dazjzualk7v2n3jtxujl43ynw7jtfuf34njt6w@5sml5vvq57gh>

> > > Looking at ax88172a.c, lan78xx.c and smsc95xx.c, they don't have
> > > anything like this. Is asix special, or are all the others broken as
> > > well?
> > 
> > I have limited USB net devices. So I can't test others now.
> > 
> > But based on the error path, only below driver call phy_stop() or phylink_stop()
> > in their stop() callback:
> > 
> > drivers/net/usb/asix_devices.c
> >   ax88772_stop()
> >     phylink_stop()
> > 
> > drivers/net/usb/ax88172a.c
> >   ax88172a_stop()
> >     phy_stop()
> > 
> > drivers/net/usb/lan78xx.c
> >   lan78xx_stop()
> >     phylink_stop()
> > 
> > drivers/net/usb/smsc95xx.c
> >   smsc95xx_stop()
> >     phy_stop()
> > 
> > However, only asix_devices.c and lan78xx.c call phylink_suspend() in suspend()
> > callback. So I think lan78xx.c has this issue too.
> > 
> > Should I change usbnet common code like below?
> > 
> > diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> > index c39dfa17813a..44a8d325dfb1 100644
> > --- a/drivers/net/usb/usbnet.c
> > +++ b/drivers/net/usb/usbnet.c
> > @@ -839,7 +839,7 @@ int usbnet_stop (struct net_device *net)
> >         pm = usb_autopm_get_interface(dev->intf);
> >         /* allow minidriver to stop correctly (wireless devices to turn off
> >          * radio etc) */
> > -       if (info->stop) {
> > +       if (info->stop && !dev->suspend_count) {
> >                 retval = info->stop(dev);
> >                 if (retval < 0)
> >                         netif_info(dev, ifdown, dev->net,
> 
> Do you mind sharing some suggestions on this? Thanks in advance!

It does look to be a common problem, so solving it in usbnet would be
best.

	Andrew

  reply	other threads:[~2025-08-15 12:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-06  8:30 [PATCH] net: usb: asix: avoid to call phylink_stop() a second time Xu Yang
2025-08-06 15:58 ` Andrew Lunn
2025-08-07  4:03   ` Xu Yang
2025-08-15  8:15     ` Xu Yang
2025-08-15 12:59       ` Andrew Lunn [this message]
2025-08-18  6:44         ` Xu Yang

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=1c352c2f-c8b3-4cbe-9921-8ba5f0e4b433@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=jun.li@nxp.com \
    --cc=khalasa@piap.pl \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=max.schulze@online.de \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=xu.yang_2@nxp.com \
    /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