Skip to contentSkip to conversation

PowerMac: force only suspend-to-disk to be valid

PATCH Johannes Berg 3 participants 6 messages May 2, 2006 – May 25, 2006

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

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 I think they ought to be passing it down since they do really need support (or am I mistaken again?) so we handle it there regardless.

Cc Benjamin Herrenschmidt <[email protected]>
arch/powerpc/platforms/powermac/setup.c +12 -0
@@ -463,11 +463,23 @@ static int pmac_pm_finish(suspend_state_
 	return 0;
 }
 
+static int pmac_pm_valid(suspend_state_t state)
+{
+	switch (state) {
+	case PM_SUSPEND_DISK:
+		return 1;
+	/* can't do any other states via generic mechanism yet */
+	default:
+		return 0;
+	}
+}
+
 static struct pm_ops pmac_pm_ops = {
 	.pm_disk_mode	= PM_DISK_SHUTDOWN,
 	.prepare	= pmac_pm_prepare,
 	.enter		= pmac_pm_enter,
 	.finish		= pmac_pm_finish,
+	.valid		= pmac_pm_valid,
 };
 
 #endif /* CONFIG_SOFTWARE_SUSPEND */
#1 lore raw
Quoted 5 lines · Johannes Berg

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 I think they ought to be passing it down since they do really need support (or am I mistaken again?) so we handle it there regardless.

No one ever seemed to care about this patch, can we queue it up for 2.6.18? I suppose it's too late now for 2.6.17 even if it fixes the long-standing but that on ppc, /sys/power/state kills the machine.

[quoted patch for reference]

Quoted 26 lines
arch/powerpc/platforms/powermac/setup.c +12 -0
@@ -463,11 +463,23 @@ static int pmac_pm_finish(suspend_state_
 	return 0;
 }
 
+static int pmac_pm_valid(suspend_state_t state)
+{
+	switch (state) {
+	case PM_SUSPEND_DISK:
+		return 1;
+	/* can't do any other states via generic mechanism yet */
+	default:
+		return 0;
+	}
+}
+
 static struct pm_ops pmac_pm_ops = {
 	.pm_disk_mode	= PM_DISK_SHUTDOWN,
 	.prepare	= pmac_pm_prepare,
 	.enter		= pmac_pm_enter,
 	.finish		= pmac_pm_finish,
+	.valid		= pmac_pm_valid,
 };
 
 #endif /* CONFIG_SOFTWARE_SUSPEND */
#2 lore raw
Quoted 9 lines · Johannes Berg
Quoted 5 lines · Johannes Berg

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 I think they ought to be passing it down since they do really need support (or am I mistaken again?) so we handle it there regardless.

No one ever seemed to care about this patch,

I don't recall having seen it before.

Quoted 31 lines

can we queue it up for
2.6.18? I suppose it's too late now for 2.6.17 even if it fixes the long-standing but that on ppc, /sys/power/state kills the machine.

[quoted patch for reference]

Quoted 25 lines
arch/powerpc/platforms/powermac/setup.c +12 -0
@@ -463,11 +463,23 @@ static int pmac_pm_finish(suspend_state_
 	return 0;
 }
 
+static int pmac_pm_valid(suspend_state_t state)
+{
+	switch (state) {
+	case PM_SUSPEND_DISK:
+		return 1;
+	/* can't do any other states via generic mechanism yet */
+	default:
+		return 0;
+	}
+}
+
 static struct pm_ops pmac_pm_ops = {
 	.pm_disk_mode	= PM_DISK_SHUTDOWN,
 	.prepare	= pmac_pm_prepare,
 	.enter		= pmac_pm_enter,
 	.finish		= pmac_pm_finish,
+	.valid		= pmac_pm_valid,
 };
 
Quoted 2 lines

arch/powerpc/platforms/powermac/setup.c static int pmac_pm_finish(suspend_state_ · line 485

Quoted 1 line
arch/powerpc/platforms/powermac/setup.c +0 -0
 #endif /* CONFIG_SOFTWARE_SUSPEND */

It looks like a 2.6.17 patch to me. If someone wants to send it over with changelog, signed-off-by, etc I can take care of it.

#3 lore raw
Quoted 20 lines · Andrew Morton
Quoted 20 lines
Quoted 20 lines
arch/powerpc/platforms/powermac/setup.c +12 -0
+static int pmac_pm_valid(suspend_state_t state)
+{
+	switch (state) {
+	case PM_SUSPEND_DISK:
+		return 1;
+	/* can't do any other states via generic mechanism yet */
+	default:
+		return 0;
+	}
+}
+
 static struct pm_ops pmac_pm_ops = {
 	.pm_disk_mode	= PM_DISK_SHUTDOWN,
 	.prepare	= pmac_pm_prepare,
 	.enter		= pmac_pm_enter,
 	.finish		= pmac_pm_finish,
+	.valid		= pmac_pm_valid,
 };
Quoted 6 lines
Quoted 2 lines
Quoted 1 line

#endif /* CONFIG_SOFTWARE_SUSPEND */

It looks like a 2.6.17 patch to me. If someone wants to send it over with changelog, signed-off-by, etc I can take care of it.

Please also explain whether this fix is needed in 2.6.16.x.

#4 lore raw
Quoted 1 line · Andrew Morton

Please also explain whether this fix is needed in 2.6.16.x.

Well, for a very long time, echoing 'standby' or 'mem' into /sys/power/state has killed the machine on powerpc. This patch fixes that. So I guess yes, it is applicable to 2.6.16.x

johannes

#5 lore raw
In reply to Andrew Morton
Quoted 3 lines

It looks like a 2.6.17 patch to me. If someone wants to send it over with changelog, signed-off-by, etc I can take care of it.

Yup, it's good, I must have forgotten to ack it (too much travel & other things lately)

Ben.