Re: [Bug 10030] Suspend doesn't work when SD card is inserted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux