[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a25b24ec-67bd-42b7-ac7b-9b8d729faba4@rowland.harvard.edu>
Date: Fri, 12 Sep 2025 10:29:47 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Jakub Kicinski <kuba@...nel.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Oleksij Rempel <o.rempel@...gutronix.de>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Hubert Wiśniewski <hubert.wisniewski.25632@...il.com>,
stable@...r.kernel.org, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Lukas Wunner <lukas@...ner.de>, Xu Yang <xu.yang_2@....com>,
linux-usb@...r.kernel.org
Subject: Re: [PATCH net v1 1/1] net: usb: asix: ax88772: drop phylink use in
PM to avoid MDIO runtime PM wakeups
On Fri, Sep 12, 2025 at 09:33:05AM +0100, Russell King (Oracle) wrote:
> On Thu, Sep 11, 2025 at 10:30:09PM -0400, Alan Stern wrote:
> > The USB subsystem uses only one pair of callbacks for suspend and resume
> > because USB hardware has only one suspend state. However, the callbacks
> > do get an extra pm_message_t parameter which they can use to distinguish
> > between system sleep transitions and runtime PM transitions.
>
> Unfortunately, this isn't the case. While a struct usb_device_driver's
> suspend()/resume() methods get the pm_message_t, a struct usb_driver's
> suspend()/resume() methods do not:
>
> static int usb_resume_interface(struct usb_device *udev,
> struct usb_interface *intf, pm_message_t msg, int reset_resume)
> {
> struct usb_driver *driver;
> ...
> if (reset_resume) {
> if (driver->reset_resume) {
> status = driver->reset_resume(intf);
> ...
> } else {
> status = driver->resume(intf);
>
> vs
>
> static int usb_resume_device(struct usb_device *udev, pm_message_t msg)
> {
> struct usb_device_driver *udriver;
> ...
> if (status == 0 && udriver->resume)
> status = udriver->resume(udev, msg);
>
> and in drivers/net/usb/asix_devices.c:
>
> static struct usb_driver asix_driver = {
> ...
> .suspend = asix_suspend,
> .resume = asix_resume,
> .reset_resume = asix_resume,
>
> where asix_resume() only takes one argument:
>
> static int asix_resume(struct usb_interface *intf)
> {
Your email made me go back and check the code more carefully, and it
turns out that we were both half-right. :-)
The pm_message_t argument is passed to the usb_driver's ->suspend
callback in usb_suspend_interface(), but not to the ->resume callback in
usb_resume_interface(). Yes, it's inconsistent.
I suppose the API could be changed, at the cost of updating a lot of
drivers. But it would be easier if this wasn't necessary, if there was
some way to work around the problem. Unfortunately, I don't know
anything about how the network stack handles suspend and resume, or
what sort of locking it requires, so I can't offer any suggestions.
Alan Stern
Powered by blists - more mailing lists