Messages in this thread Patch in this message | | | Date | Mon, 13 Oct 2003 09:36:55 -0700 | From | David Brownell <> | Subject | [patch 2.6.0-test7] PM resume must allow device removal |
| |
Hi Patrick,
Here's a patch that resolves the PM problem I reported last week: the self-deadlock during PM resume, in the case where devices vanished during suspend. That's typical in certain OHCI-HCD resume scenarios (where the HC loses power) and may eventually happen in other cases, as drivers for hotpluggable buses become more intelligent about things getting unplugged.
You may want to have a more elaborate fix. It looked to me like that lock was overloaded ... it's serving not just to protect the list of PM devices against concurrent changes, but also to make sure only one task was managing PM suspend/resume. It seems to me that the "one task" rule would better be handled by some sort of state flag.
- Dave
--- 1.11/drivers/base/power/resume.c Mon Aug 25 11:08:21 2003 +++ edited/drivers/base/power/resume.c Fri Oct 10 21:06:07 2003 @@ -22,8 +22,17 @@ int resume_device(struct device * dev) { - if (dev->bus && dev->bus->resume) - return dev->bus->resume(dev); + if (dev->bus && dev->bus->resume) { + int retval; + + /* drop lock so the call can use device_del() to clean up + * after unplugged (or otherwise vanished) child devices + */ + up(&dpm_sem); + retval = dev->bus->resume(dev); + down(&dpm_sem); + return retval; + } return 0; } | |