Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] PowerMac: force only suspend-to-disk to be valid

For a very long time, echoing 'standby' or 'mem' into /sys/power/state has
killed the machine on powerpc. This patch fixes that.

This patch adds the .valid callback to pm_ops on PowerMac so that only the
suspend to disk state can be entered. Note that just returning 0 would
suffice since the upper layers don't pass PM_SUSPEND_DISK down, but we
handle it there regardless just in case that changes.

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Johannes Berg and committed by
Linus Torvalds
0fba3a1f 3ac81413

+12
+12
arch/powerpc/platforms/powermac/setup.c
··· 463 463 return 0; 464 464 } 465 465 466 + static int pmac_pm_valid(suspend_state_t state) 467 + { 468 + switch (state) { 469 + case PM_SUSPEND_DISK: 470 + return 1; 471 + /* can't do any other states via generic mechanism yet */ 472 + default: 473 + return 0; 474 + } 475 + } 476 + 466 477 static struct pm_ops pmac_pm_ops = { 467 478 .pm_disk_mode = PM_DISK_SHUTDOWN, 468 479 .prepare = pmac_pm_prepare, 469 480 .enter = pmac_pm_enter, 470 481 .finish = pmac_pm_finish, 482 + .valid = pmac_pm_valid, 471 483 }; 472 484 473 485 #endif /* CONFIG_SOFTWARE_SUSPEND */