summaryrefslogtreecommitdiff
path: root/drivers/usb/cdns3/cdns3-plat.c
diff options
context:
space:
mode:
authorXiaolei Wang <xiaolei.wang@windriver.com>2023-06-16 10:19:51 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-25 17:49:25 +0200
commit2319b9c87fe243327285f2fefd7374ffd75a65fc (patch)
tree6a77ea16db2346c3d5525602e358d55b1440f47a /drivers/usb/cdns3/cdns3-plat.c
parent6eaae198076080886b9e7d57f4ae06fa782f90ef (diff)
downloadlinux-2319b9c87fe243327285f2fefd7374ffd75a65fc.tar.gz
linux-2319b9c87fe243327285f2fefd7374ffd75a65fc.tar.bz2
linux-2319b9c87fe243327285f2fefd7374ffd75a65fc.zip
usb: cdns3: Put the cdns set active part outside the spin lock
The device may be scheduled during the resume process, so this cannot appear in atomic operations. Since pm_runtime_set_active will resume suppliers, put set active outside the spin lock, which is only used to protect the struct cdns data structure, otherwise the kernel will report the following warning: BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1163 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 651, name: sh preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 CPU: 0 PID: 651 Comm: sh Tainted: G WC 6.1.20 #1 Hardware name: Freescale i.MX8QM MEK (DT) Call trace: dump_backtrace.part.0+0xe0/0xf0 show_stack+0x18/0x30 dump_stack_lvl+0x64/0x80 dump_stack+0x1c/0x38 __might_resched+0x1fc/0x240 __might_sleep+0x68/0xc0 __pm_runtime_resume+0x9c/0xe0 rpm_get_suppliers+0x68/0x1b0 __pm_runtime_set_status+0x298/0x560 cdns_resume+0xb0/0x1c0 cdns3_controller_resume.isra.0+0x1e0/0x250 cdns3_plat_resume+0x28/0x40 Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com> Acked-by: Peter Chen <peter.chen@kernel.org> Link: https://lore.kernel.org/r/20230616021952.1025854-1-xiaolei.wang@windriver.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-plat.c')
-rw-r--r--drivers/usb/cdns3/cdns3-plat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/cdns3/cdns3-plat.c b/drivers/usb/cdns3/cdns3-plat.c
index 884e2301237f..1168dbeed2ce 100644
--- a/drivers/usb/cdns3/cdns3-plat.c
+++ b/drivers/usb/cdns3/cdns3-plat.c
@@ -255,9 +255,10 @@ static int cdns3_controller_resume(struct device *dev, pm_message_t msg)
cdns3_set_platform_suspend(cdns->dev, false, false);
spin_lock_irqsave(&cdns->lock, flags);
- cdns_resume(cdns, !PMSG_IS_AUTO(msg));
+ cdns_resume(cdns);
cdns->in_lpm = false;
spin_unlock_irqrestore(&cdns->lock, flags);
+ cdns_set_active(cdns, !PMSG_IS_AUTO(msg));
if (cdns->wakeup_pending) {
cdns->wakeup_pending = false;
enable_irq(cdns->wakeup_irq);