lkml.org 
[lkml]   [2008]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Bug 10030] Suspend doesn't work when SD card is inserted
On Sun, 24 Feb 2008, Rafael J. Wysocki wrote:

> > You know, with this new patch we probably don't need
> > device_pm_schedule_removal() any more.
>
> No, we don't. However, because of that dpm_suspend() and device_power_down()
> need to be changed not to assume that the removed devices will end up on
> dpm_destroy.

Yes. The safest approach will be to check whether the device is still
at the end of the dpm_locked or dpm_off list; if it hasn't then we can
assume that it has been removed (or scheduled for removal).

> IMO you also should add this change in device_power_down():
>
> @@ -388,18 +343,15 @@ int device_power_down(pm_message_t state
> struct list_head *entry = dpm_off.prev;
> struct device *dev = to_device(entry);
>
> - list_del_init(&dev->power.entry);
> error = suspend_device_late(dev, state);
> if (error) {
> printk(KERN_ERR "Could not power down device %s: "
> "error %d\n",
> kobject_name(&dev->kobj), error);
> - if (list_empty(&dev->power.entry))
> - list_add(&dev->power.entry, &dpm_off);
> break;
> }
> - if (list_empty(&dev->power.entry))
> - list_add(&dev->power.entry, &dpm_off_irq);
> + if (!list_empty(&dev->power.entry))
> + list_move(&dev->power.entry, &dpm_off_irq);
> }

Actually I changed the last two lines to:

+
+ /* Don't move the entry if the device has been unregistered */
+ if (entry == dpm_off.prev)
+ list_move(entry, &dpm_off_irq);

with analogous changes to dpm_suspend().

Any more suggestions for updates?

Alan Stern



\
 
 \ /
  Last update: 2008-02-24 23:27    [W:1.390 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site