Skip to contentSkip to conversation

-mm swsusp: fix highmem handling

PATCH Pavel Machek 2 participants 3 messages Aug 9, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi!

This fixes highmem handling, and adds some comments so that others do not fall into the same trap I fallen in: code does not continue below swsusp_arch_resume if things go okay.

Please apply,
Pavel

kernel/power/swsusp.c +8 -0
@@ -870,8 +866,12 @@
 	local_irq_disable();
 	save_processor_state();
 	error = swsusp_arch_suspend();
+	/* Restore control flow magically appears here */
 	restore_processor_state();
 	local_irq_enable();
+#ifdef CONFIG_HIGHMEM
+	restore_highmem();
+#endif
 	return error;
 }
 
@@ -890,8 +889,12 @@
 {
 	int error;
 	local_irq_disable();
 	save_processor_state();
 	error = swsusp_arch_resume();
+	/* Code below is only ever reached in case of failure. Otherwise
+	 * execution continues at place where swsusp_arch_suspend was called
+         */
+	BUG_ON(!error);
 	restore_processor_state();
 	local_irq_enable();
 	return error;
Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#1 lore raw
Quoted 11 lines · Pavel Machek

This fixes highmem handling, and adds some comments so that others do not fall into the same trap I fallen in: code does not continue below swsusp_arch_resume if things go okay.

Please apply,
Pavel

kernel/power/swsusp.c line 875

Quoted 10 lines
kernel/power/swsusp.c +4 -0
@@ -870,8 +866,12 @@
 	local_irq_disable();
 	save_processor_state();
 	error = swsusp_arch_suspend();
+	/* Restore control flow magically appears here */
 	restore_processor_state();
 	local_irq_enable();
+#ifdef CONFIG_HIGHMEM
+	restore_highmem();
+#endif
 	return error;

restore_highmem() is a noop if !CONFIG_HIGHMEM, so I shall remove the above ifdef/endif.

#2 lore raw
In reply to Pavel Machek
Quoted 4 lines · Pavel Machek

This fixes highmem handling, and adds some comments so that others do not fall into the same trap I fallen in: code does not continue below swsusp_arch_resume if things go okay.

Actually these changes seem to be in Pat's tree already. Please check next -mm, raise a patch against that.