mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 01:21:28 +00:00
PM: Warn if interrupts are enabled during suspend-resume of sysdevs
Sysdevs have to be suspended and resumed with interrupts disabled and things usually break in a way that's difficult to debug if one of sysdev drivers enables interrupts by mistake during suspend or resume. Add extra checks that will generate warnings in such cases. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
This commit is contained in:
parent
ce4b3c5547
commit
62b0124761
@ -343,11 +343,15 @@ static void __sysdev_resume(struct sys_device *dev)
|
||||
/* First, call the class-specific one */
|
||||
if (cls->resume)
|
||||
cls->resume(dev);
|
||||
WARN_ONCE(!irqs_disabled(),
|
||||
"Interrupts enabled after %pF\n", cls->resume);
|
||||
|
||||
/* Call auxillary drivers next. */
|
||||
list_for_each_entry(drv, &cls->drivers, entry) {
|
||||
if (drv->resume)
|
||||
drv->resume(dev);
|
||||
WARN_ONCE(!irqs_disabled(),
|
||||
"Interrupts enabled after %pF\n", drv->resume);
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,6 +381,9 @@ int sysdev_suspend(pm_message_t state)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
WARN_ONCE(!irqs_disabled(),
|
||||
"Interrupts enabled while suspending system devices\n");
|
||||
|
||||
pr_debug("Suspending System Devices\n");
|
||||
|
||||
list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) {
|
||||
@ -393,6 +400,9 @@ int sysdev_suspend(pm_message_t state)
|
||||
if (ret)
|
||||
goto aux_driver;
|
||||
}
|
||||
WARN_ONCE(!irqs_disabled(),
|
||||
"Interrupts enabled after %pF\n",
|
||||
drv->suspend);
|
||||
}
|
||||
|
||||
/* Now call the generic one */
|
||||
@ -400,6 +410,9 @@ int sysdev_suspend(pm_message_t state)
|
||||
ret = cls->suspend(sysdev, state);
|
||||
if (ret)
|
||||
goto cls_driver;
|
||||
WARN_ONCE(!irqs_disabled(),
|
||||
"Interrupts enabled after %pF\n",
|
||||
cls->suspend);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -452,6 +465,9 @@ int sysdev_resume(void)
|
||||
{
|
||||
struct sysdev_class *cls;
|
||||
|
||||
WARN_ONCE(!irqs_disabled(),
|
||||
"Interrupts enabled while resuming system devices\n");
|
||||
|
||||
pr_debug("Resuming System Devices\n");
|
||||
|
||||
list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) {
|
||||
|
Loading…
Reference in New Issue
Block a user