* [PATCH] usb: core: don't skip system resume for an already suspended device
[not found] <CGME20261116125643epcas5p17e73b0fa50f1cb7609b1d90d62c5e3f6@epcas5p1.samsung.com>
@ 2026-11-16 12:56 ` Selvarasu Ganesan
2026-11-16 13:13 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Selvarasu Ganesan @ 2026-11-16 12:56 UTC (permalink / raw)
To: gregkh, shashank.mahadasyam, rahul.bukte, hadess, dakr, gary,
guanyulin, rafael.j.wysocki, mathias.nyman, linux-usb,
linux-kernel
Cc: jh0801.jung, dh10.jung, akash.m5, hongpooh.kim, eomji.oh,
alim.akhtar, muhammed.ali, thiagu.r, cpgs, Selvarasu Ganesan,
stable
When offload is active on a USB device, usb_suspend_both() skips
suspending it during system suspend so that the port is not pushed
into its deep low power state.
The commit bd3d245b0fef ("usb: core: use dedicated spinlock for offload
state") made the resume path skip resuming the device whenever offload
is active at resume time, instead of only when the corresponding suspend
was skipped. That is wrong when the device was already suspended:
1. Streaming is running with offload active and the AP side stops
using the device, the user pauses streaming, or the USB interface
simply becomes idle.
2. The device auto-suspends. The auto-suspend path
(PMSG_AUTO_SUSPEND) does not carry the PM_EVENT_SUSPEND event, so
the offload state is not consulted. The port goes into its deep
low-power state and the device enters USB_STATE_SUSPENDED.
3. The system enters PM suspend. The device is already suspended,
so usb_suspend_both() returns early and the offload skip never
takes effect for this sleep.
4. On system resume, usb_resume_both() re-checks usb_offload_check(),
which is still true because the offload reference is held. The
device resume is skipped even though the device is suspended, so
the connected USB device is never resumed and fails to function
after the AP resumes.
Skipping the resume is only correct when the suspend was actually
skipped, i.e. when the device was not already suspended. Check the
device state so that an already suspended device always goes through a
normal resume, as before bd3d245b0fef.
Fixes: bd3d245b0fef ("usb: core: use dedicated spinlock for offload state")
Cc: stable@vger.kernel.org
Signed-off-by: Selvarasu Ganesan <selvarasu.g@samsung.com>
---
drivers/usb/core/driver.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index f21b1e4f9c09..48addbd1a69a 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1552,7 +1552,15 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg)
goto done;
}
udev->can_submit = 1;
- if (msg.event == PM_EVENT_RESUME)
+ /*
+ * Offload is only relevant if the device was kept active during the
+ * corresponding suspend. A device that is already suspended (for
+ * example auto-suspended during an idle gap) must go through a
+ * normal resume, otherwise the port would be left in its deep
+ * low-power state after system resume.
+ */
+ if (msg.event == PM_EVENT_RESUME &&
+ udev->state != USB_STATE_SUSPENDED)
offload_active = usb_offload_check(udev);
/* Resume the device */
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread