Re: [PATCH 2/2] Fix console handling during suspend/resume

Alan Stern
2006-06-24T16:24:44Z

On Fri, 23 Jun 2006, Linus Torvalds wrote:

> Ok, here.
>
> This simple patch is nothing but cleanups, cleanups, cleanups.

> - "suspend_prepare()" is called for every device (with the semaphore
> held, you are _not_ allowed to try to unlink yourself in the prepare
> function)

There should be a big fat warning about this somewhere, maybe added to the
documentation. It's quite possible for dpm_list_sem to be acquired while
holding a device's lock; since the suspend_prepare() method is called
while holding dpm_list_sem it therefore mustn't do _anything_ to acquire
any device's lock. That includes plenty of other actions in addition to
unregistering the device.

In particular, it may complicate synchronization between suspend_prepare()
and the rest of the driver.

Alan Stern