Re: [PATCH] swsusp: properly suspend and resume *all* devices

Barry K. Nathan
2005-01-04T05:17:47Z

On Mon, Jan 03, 2005 at 07:33:18PM +0100, Pavel Machek wrote:
> > Ack. [I have similar patch in my tree, but yours is better in error
> > checking area. Please push it to akpm.]
>
> Actually you missed second half: same code should be added around
> swsusp_arch_resume. It is not too critical there, but its right thing
> to do.

Hmmm... I'm not sure how necessary it is, and I think it slows down
resume a tiny bit. However, the more I think about it the more correct it
seems, so here's the follow-up patch. (Andrew, even if this patch is
rejected, please commit my first one to the next -mm release. That patch
alone is still an improvement over the current code.)

Signed-off-by: Barry K. Nathan <barryn@pobox.com>

--- linux-2.6.10-mm1-bkn3/kernel/power/swsusp.c 2005-01-03 06:27:07.753344731 -0800
+++ linux-2.6.10-mm1-bkn4/kernel/power/swsusp.c 2005-01-03 20:19:06.737439106 -0800
@@ -878,6 +878,7 @@
{
int error;
local_irq_disable();
+ device_power_down(PM_SUSPEND_DISK);
/* We'll ignore saved state, but this gets preempt count (etc) right */
save_processor_state();
error = swsusp_arch_resume();
@@ -887,6 +888,7 @@
BUG_ON(!error);
restore_processor_state();
restore_highmem();
+ device_power_up();
local_irq_enable();
return error;
}