]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
usb: core: use dedicated spinlock for offload state
authorGuan-Yu Lin <guanyulin@google.com>
Wed, 1 Apr 2026 12:32:17 +0000 (12:32 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2026 07:43:26 +0000 (09:43 +0200)
commitbd3d245b0fef571f93504904df62b8865b1c0d34
tree1d37ac524cf4db558d5b86a11a4e545bbea5e8e9
parentc32f8748d70c8fc77676ad92ed76cede17bf2c48
usb: core: use dedicated spinlock for offload state

Replace the coarse USB device lock with a dedicated offload_lock
spinlock to reduce contention during offload operations. Use
offload_pm_locked to synchronize with PM transitions and replace
the legacy offload_at_suspend flag.

Optimize usb_offload_get/put by switching from auto-resume/suspend
to pm_runtime_get_if_active(). This ensures offload state is only
modified when the device is already active, avoiding unnecessary
power transitions.

Cc: stable <stable@kernel.org>
Fixes: ef82a4803aab ("xhci: sideband: add api to trace sideband usage")
Signed-off-by: Guan-Yu Lin <guanyulin@google.com>
Tested-by: Hailong Liu <hailong.liu@oppo.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20260401123238.3790062-2-guanyulin@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/driver.c
drivers/usb/core/offload.c
drivers/usb/core/usb.c
drivers/usb/host/xhci-sideband.c
include/linux/usb.h