From: Selvarasu Ganesan <selvarasu.g@samsung.com>
To: gregkh@linuxfoundation.org, shashank.mahadasyam@sony.com,
rahul.bukte@sony.com, hadess@hadess.net, dakr@kernel.org,
gary@garyguo.net, guanyulin@google.com,
rafael.j.wysocki@intel.com, mathias.nyman@linux.intel.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jh0801.jung@samsung.com, dh10.jung@samsung.com,
akash.m5@samsung.com, hongpooh.kim@samsung.com,
eomji.oh@samsung.com, alim.akhtar@samsung.com,
muhammed.ali@samsung.com, thiagu.r@samsung.com, cpgs@samsung.com,
Selvarasu Ganesan <selvarasu.g@samsung.com>,
stable@vger.kernel.org
Subject: [PATCH] usb: core: don't skip system resume for an already suspended device
Date: Mon, 16 Nov 2026 18:26:25 +0530 [thread overview]
Message-ID: <973576304.21794834003625.JavaMail.epsvc@epcpadp1new> (raw)
In-Reply-To: CGME20261116125643epcas5p17e73b0fa50f1cb7609b1d90d62c5e3f6@epcas5p1.samsung.com
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
next parent reply other threads:[~2026-11-16 13:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20261116125643epcas5p17e73b0fa50f1cb7609b1d90d62c5e3f6@epcas5p1.samsung.com>
2026-11-16 12:56 ` Selvarasu Ganesan [this message]
2026-11-16 13:13 ` [PATCH] usb: core: don't skip system resume for an already suspended device sashiko-bot
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=973576304.21794834003625.JavaMail.epsvc@epcpadp1new \
--to=selvarasu.g@samsung.com \
--cc=akash.m5@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=cpgs@samsung.com \
--cc=dakr@kernel.org \
--cc=dh10.jung@samsung.com \
--cc=eomji.oh@samsung.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=guanyulin@google.com \
--cc=hadess@hadess.net \
--cc=hongpooh.kim@samsung.com \
--cc=jh0801.jung@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=muhammed.ali@samsung.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rahul.bukte@sony.com \
--cc=shashank.mahadasyam@sony.com \
--cc=stable@vger.kernel.org \
--cc=thiagu.r@samsung.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