Re: 2.6.23-mm1 pm_prepare() and _finish() w/ args vs. without

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Joseph Fannin
Date: Sunday, October 14, 2007 - 12:47 pm

On Sat, Oct 13, 2007 at 09:13:13PM +0200, Rafael J. Wysocki wrote:


A bit more is needed due to the rename of lite5200_pm_init() to
lite5200_suspend_init().  An amended patch follows that builds and
boots on my powermac.


---

diff -aurN linux-2.6.23-mm1.orig/arch/powerpc/platforms/52xx/lite5200.c linux-2.6.23-mm1/arch/powerpc/platforms/52xx/lite5200.c
--- linux-2.6.23-mm1.orig/arch/powerpc/platforms/52xx/lite5200.c	2007-10-12 16:21:47.000000000 -0400
+++ linux-2.6.23-mm1/arch/powerpc/platforms/52xx/lite5200.c	2007-10-14 11:49:29.000000000 -0400
@@ -126,7 +126,7 @@
 #ifdef CONFIG_PM
 	mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
 	mpc52xx_suspend.board_resume_finish = lite5200_resume_finish;
-	lite5200_pm_init();
+	lite5200_suspend_init();
 #endif
 
 #ifdef CONFIG_PCI
diff -aurN linux-2.6.23-mm1.orig/arch/powerpc/platforms/52xx/lite5200_pm.c linux-2.6.23-mm1/arch/powerpc/platforms/52xx/lite5200_pm.c
--- linux-2.6.23-mm1.orig/arch/powerpc/platforms/52xx/lite5200_pm.c	2007-10-14 11:10:57.000000000 -0400
+++ linux-2.6.23-mm1/arch/powerpc/platforms/52xx/lite5200_pm.c	2007-10-14 09:06:36.000000000 -0400
@@ -1,5 +1,5 @@
 #include <linux/init.h>
-#include <linux/pm.h>
+#include <linux/suspend.h>
 #include <asm/io.h>
 #include <asm/time.h>
 #include <asm/mpc52xx.h>
@@ -18,6 +18,8 @@
 static const int sram_size = 0x4000;	/* 16 kBytes */
 static void __iomem *mbar;
 
+static suspend_state_t lite5200_pm_target_state;
+
 static int lite5200_pm_valid(suspend_state_t state)
 {
 	switch (state) {
@@ -29,13 +31,22 @@
 	}
 }
 
-static int lite5200_pm_prepare(suspend_state_t state)
+static int lite5200_pm_set_target(suspend_state_t state)
+{
+	if (lite5200_pm_valid(state)) {
+		lite5200_pm_target_state = state;
+		return 0;
+	}
+	return -EINVAL;
+}
+
+static int lite5200_pm_prepare(void)
 {
 	/* deep sleep? let mpc52xx code handle that */
-	if (state == PM_SUSPEND_STANDBY)
-		return mpc52xx_pm_prepare(state);
+	if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
+		return mpc52xx_pm_prepare();
 
-	if (state != PM_SUSPEND_MEM)
+	if (lite5200_pm_target_state != PM_SUSPEND_MEM)
 		return -EINVAL;
 
 	/* map registers */
@@ -190,24 +201,24 @@
 	return 0;
 }
 
-static int lite5200_pm_finish(suspend_state_t state)
+static void lite5200_pm_finish(void)
 {
 	/* deep sleep? let mpc52xx code handle that */
-	if (state == PM_SUSPEND_STANDBY) {
-		return mpc52xx_pm_finish(state);
+	if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) {
+		mpc52xx_pm_finish();
 	}
-	return 0;
 }
 
-static struct pm_ops lite5200_pm_ops = {
+static struct platform_suspend_ops lite5200_pm_ops = {
 	.valid		= lite5200_pm_valid,
+	.set_target	= lite5200_pm_set_target,
 	.prepare	= lite5200_pm_prepare,
 	.enter		= lite5200_pm_enter,
 	.finish		= lite5200_pm_finish,
 };
 
-int __init lite5200_pm_init(void)
+int __init lite5200_suspend_init(void)
 {
-	pm_set_ops(&lite5200_pm_ops);
+	suspend_set_ops(&lite5200_pm_ops);
 	return 0;
 }
diff -aurN linux-2.6.23-mm1.orig/arch/powerpc/platforms/52xx/mpc52xx_pm.c linux-2.6.23-mm1/arch/powerpc/platforms/52xx/mpc52xx_pm.c
--- linux-2.6.23-mm1.orig/arch/powerpc/platforms/52xx/mpc52xx_pm.c	2007-10-14 11:10:57.000000000 -0400
+++ linux-2.6.23-mm1/arch/powerpc/platforms/52xx/mpc52xx_pm.c	2007-10-14 09:06:36.000000000 -0400
@@ -57,7 +57,7 @@
 	return 0;
 }
 
-static int mpc52xx_pm_prepare(void)
+int mpc52xx_pm_prepare(void)
 {
 	/* map the whole register space */
 	mbar = mpc52xx_find_and_map("mpc5200");
@@ -163,7 +163,7 @@
 	return 0;
 }
 
-static void mpc52xx_pm_finish(void)
+void mpc52xx_pm_finish(void)
 {
 	/* call board resume code */
 	if (mpc52xx_suspend.board_resume_finish)
diff -aurN linux-2.6.23-mm1.orig/include/asm-powerpc/mpc52xx.h linux-2.6.23-mm1/include/asm-powerpc/mpc52xx.h
--- linux-2.6.23-mm1.orig/include/asm-powerpc/mpc52xx.h	2007-10-14 11:10:57.000000000 -0400
+++ linux-2.6.23-mm1/include/asm-powerpc/mpc52xx.h	2007-10-14 11:42:59.000000000 -0400
@@ -18,6 +18,8 @@
 #include <asm/prom.h>
 #endif /* __ASSEMBLY__ */
 
+#include <linux/suspend.h>
+
 
 /* ======================================================================== */
 /* Structures mapping of some unit register set                             */
@@ -264,12 +266,12 @@
 extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);
 
 #ifdef CONFIG_PPC_LITE5200
-extern int __init lite5200_pm_init(void);
+extern int __init lite5200_suspend_init(void);
 
 /* lite5200 calls mpc5200 suspend functions, so here they are */
-extern int mpc52xx_pm_prepare(suspend_state_t);
+extern int mpc52xx_pm_prepare(void);
 extern int mpc52xx_pm_enter(suspend_state_t);
-extern int mpc52xx_pm_finish(suspend_state_t);
+extern void mpc52xx_pm_finish(void);
 extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
 #endif
 #endif /* CONFIG_PM */

--
Joseph Fannin
jfannin@gmail.com

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.23-mm1, Andrew Morton, (Thu Oct 11, 9:31 pm)
Re: 2.6.23-mm1, KAMEZAWA Hiroyuki, (Thu Oct 11, 10:03 pm)
Re: 2.6.23-mm1, Andrew Morton, (Thu Oct 11, 11:42 pm)
Re: 2.6.23-mm1, Al Viro, (Thu Oct 11, 11:46 pm)
Re: 2.6.23-mm1, Cedric Le Goater, (Thu Oct 11, 11:48 pm)
[PATCH] add missing parenthesis in cfe_writeblk() macro, Mariusz Kozlowski, (Thu Oct 11, 11:51 pm)
Re: 2.6.23-mm1, Andrew Morton, (Fri Oct 12, 12:13 am)
Re: 2.6.23-mm1, KAMEZAWA Hiroyuki, (Fri Oct 12, 12:25 am)
Re: 2.6.23-mm1 - build failure on axonram, Kamalesh Babulal, (Fri Oct 12, 12:44 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Fri Oct 12, 1:31 am)
Re: 2.6.23-mm1, Sam Ravnborg, (Fri Oct 12, 1:36 am)
Re: 2.6.23-mm1, Andrew Morton, (Fri Oct 12, 1:37 am)
Build Failure (Was Re: 2.6.23-mm1), Dhaval Giani, (Fri Oct 12, 2:42 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Fri Oct 12, 5:46 am)
[PATCH net-2.6] uml: hard_header fix, Stephen Hemminger, (Fri Oct 12, 11:06 am)
Re: 2.6.23-mm1, Al Viro, (Fri Oct 12, 12:04 pm)
Re: 2.6.23-mm1 thread exit_group issue, Mathieu Desnoyers, (Fri Oct 12, 12:47 pm)
Re: 2.6.23-mm1 thread exit_group issue, Andrew Morton, (Fri Oct 12, 1:01 pm)
Re: 2.6.23-mm1, Laurent Riffard, (Fri Oct 12, 1:38 pm)
Re: 2.6.23-mm1, Andrew Morton, (Fri Oct 12, 2:00 pm)
Re: 2.6.23-mm1, Rafael J. Wysocki, (Fri Oct 12, 2:32 pm)
Re: 2.6.23-mm1 thread exit_group issue, Andrew Morton, (Fri Oct 12, 6:03 pm)
Re: 2.6.23-mm1 - Build failure on rgmii, Kamalesh Babulal, (Fri Oct 12, 9:35 pm)
Re: 2.6.23-mm1 - build failure with advansys, Kamalesh Babulal, (Fri Oct 12, 9:44 pm)
Re: 2.6.23-mm1 - build failure with advansys, Andrew Morton, (Fri Oct 12, 11:52 pm)
Re: 2.6.23-mm1, Torsten Kaiser, (Sat Oct 13, 1:01 am)
Re: 2.6.23-mm1, Jeff Garzik, (Sat Oct 13, 3:55 am)
Re: 2.6.23-mm1 thread exit_group issue, Oleg Nesterov, (Sat Oct 13, 4:48 am)
Re: 2.6.23-mm1 thread exit_group issue, Oleg Nesterov, (Sat Oct 13, 5:02 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Sat Oct 13, 5:03 am)
Re: 2.6.23-mm1, Jeff Garzik, (Sat Oct 13, 5:19 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Sat Oct 13, 7:32 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Sat Oct 13, 7:40 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Sat Oct 13, 8:13 am)
Re: 2.6.23-mm1, Gabriel C, (Sat Oct 13, 10:12 am)
Re: 2.6.23-mm1 pm_prepare() and _finish() w/ args vs. without, Rafael J. Wysocki, (Sat Oct 13, 10:22 am)
Re: 2.6.23-mm1, Jeff Garzik, (Sat Oct 13, 10:48 am)
Re: 2.6.23-mm1 thread exit_group issue, Andrew Morton, (Sat Oct 13, 10:49 am)
Suspend Broken (Re: 2.6.23-mm1), Dhaval Giani, (Sat Oct 13, 10:58 am)
Re: 2.6.23-mm1, Andrew Morton, (Sat Oct 13, 11:01 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Sat Oct 13, 11:05 am)
Re: 2.6.23-mm1, Gabriel C, (Sat Oct 13, 11:08 am)
Re: 2.6.23-mm1, Andrew Morton, (Sat Oct 13, 11:18 am)
Re: Suspend Broken (Re: 2.6.23-mm1), Rafael J. Wysocki, (Sat Oct 13, 11:33 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Sat Oct 13, 11:35 am)
Re: 2.6.23-mm1, Jeff Garzik, (Sat Oct 13, 11:41 am)
Re: 2.6.23-mm1 pm_prepare() and _finish() w/ args vs. without, Rafael J. Wysocki, (Sat Oct 13, 12:13 pm)
[2.6.23-mm1] CONFIG_LOCALVERSION handling broken, Tilman Schmidt, (Sat Oct 13, 3:11 pm)
Re: 2.6.23-mm1 thread exit_group issue, Mathieu Desnoyers, (Sat Oct 13, 9:04 pm)
Re: Suspend Broken (Re: 2.6.23-mm1), Dhaval Giani, (Sat Oct 13, 9:26 pm)
Re: 2.6.23-mm1, Torsten Kaiser, (Sun Oct 14, 4:54 am)
Re: Suspend Broken (Re: 2.6.23-mm1), Rafael J. Wysocki, (Sun Oct 14, 7:19 am)
Re: 2.6.23-mm1, Andrew Morton, (Sun Oct 14, 11:39 am)
Re: 2.6.23-mm1, Torsten Kaiser, (Sun Oct 14, 12:12 pm)
Re: 2.6.23-mm1, Andrew Morton, (Sun Oct 14, 12:26 pm)
Re: 2.6.23-mm1, Torsten Kaiser, (Sun Oct 14, 12:40 pm)
Re: 2.6.23-mm1 pm_prepare() and _finish() w/ args vs. without, Joseph Fannin, (Sun Oct 14, 12:47 pm)
Re: 2.6.23-mm1 pm_prepare() and _finish() w/ args vs. without, Rafael J. Wysocki, (Sun Oct 14, 1:20 pm)
Re: 2.6.23-mm1, Milan Broz, (Sun Oct 14, 3:03 pm)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Laurent Riffard, (Sun Oct 14, 3:34 pm)
[PATCH] Add irq protection in the percpu-counters cpu-hotp ..., Gautham R Shenoy, (Sun Oct 14, 11:18 pm)
Re: 2.6.23-mm1, Jens Axboe, (Sun Oct 14, 11:50 pm)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Christoph Hellwig, (Mon Oct 15, 1:40 am)
nfs mmap adventure (was: 2.6.23-mm1), Peter Zijlstra, (Mon Oct 15, 5:28 am)
Re: nfs mmap adventure (was: 2.6.23-mm1), David Howells, (Mon Oct 15, 7:06 am)
Re: nfs mmap adventure (was: 2.6.23-mm1), Trond Myklebust, (Mon Oct 15, 8:43 am)
Re: nfs mmap adventure (was: 2.6.23-mm1), Trond Myklebust, (Mon Oct 15, 8:51 am)
Re: 2.6.23-mm1, Mark Gross, (Mon Oct 15, 9:09 am)
Re: 2.6.23-mm1, Zan Lynx, (Mon Oct 15, 9:13 am)
Re: 2.6.23-mm1, Dave Hansen, (Mon Oct 15, 9:28 am)
Re: nfs mmap adventure (was: 2.6.23-mm1), Peter Zijlstra, (Mon Oct 15, 9:38 am)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Jeff Mahoney, (Mon Oct 15, 11:31 am)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Laurent Riffard, (Mon Oct 15, 12:51 pm)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Laurent Riffard, (Mon Oct 15, 1:06 pm)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Jeff Mahoney, (Mon Oct 15, 1:23 pm)
Re: 2.6.23-mm1, Rafael J. Wysocki, (Mon Oct 15, 1:40 pm)
Re: 2.6.23-mm1 pm_prepare() and _finish() w/ args vs. without, Rafael J. Wysocki, (Mon Oct 15, 1:55 pm)
Re: nfs mmap adventure (was: 2.6.23-mm1), David Howells, (Mon Oct 15, 4:27 pm)
Re: nfs mmap adventure (was: 2.6.23-mm1), Nick Piggin, (Mon Oct 15, 6:46 pm)
Re: 2.6.23-mm1 - regression- PowerPC link failure at arch/ ..., Kamalesh Babulal, (Tue Oct 16, 12:18 am)
Re: 2.6.23-mm1 - regression- PowerPC link failure at arch/ ..., Kamalesh Babulal, (Tue Oct 16, 12:44 am)
Re: 2.6.23-mm1, Mark Gross, (Tue Oct 16, 12:58 pm)
Re: 2.6.23-mm1, Rafael J. Wysocki, (Tue Oct 16, 1:28 pm)
Re: 2.6.23-mm1, Mark Gross, (Tue Oct 16, 4:31 pm)
Re: 2.6.23-mm1, KAMEZAWA Hiroyuki, (Wed Oct 17, 12:01 am)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Christoph Hellwig, (Wed Oct 17, 1:58 am)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Christoph Hellwig, (Wed Oct 17, 1:59 am)
Re: 2.6.23-mm1, Andrew Morton, (Wed Oct 17, 2:02 am)
Re: 2.6.23-mm1, Jiri Kosina, (Wed Oct 17, 2:10 am)
Re: 2.6.23-mm1, KAMEZAWA Hiroyuki, (Wed Oct 17, 2:36 am)
Re: 2.6.23-mm1, Jiri Kosina, (Wed Oct 17, 4:42 am)
Re: 2.6.23-mm1, KAMEZAWA Hiroyuki, (Wed Oct 17, 5:33 am)
Re: 2.6.23-mm1: BUG in reiserfs_delete_xattrs, Jeff Mahoney, (Wed Oct 17, 7:55 am)
Re: 2.6.23-mm1 - list_add corruption in cgroup, Cedric Le Goater, (Wed Oct 17, 8:54 am)
Re: [2.6.23-mm1] CONFIG_LOCALVERSION handling broken, Sam Ravnborg, (Wed Oct 17, 1:27 pm)
Re: [2.6.23-mm1] CONFIG_LOCALVERSION handling broken, Tilman Schmidt, (Wed Oct 17, 4:06 pm)
Re: 2.6.23-mm1 - build failure with advansys, Paul Mackerras, (Wed Oct 17, 5:07 pm)
Re: 2.6.23-mm1 - build failure with advansys, Matthew Wilcox, (Wed Oct 17, 6:48 pm)
Re: 2.6.23-mm1 - list_add corruption in cgroup, Paul Menage, (Thu Oct 18, 8:56 am)
PIE randomization (was Re: 2.6.23-mm1), Jiri Kosina, (Fri Oct 19, 2:07 am)
Re: 2.6.23-mm1, Jiri Kosina, (Fri Oct 19, 2:54 pm)
Re: 2.6.23-mm1 - list_add corruption in cgroup, Paul Menage, (Fri Oct 19, 3:11 pm)
oops in lbmIODone, fails to boot [Re: 2.6.23-mm1], Mattia Dongili, (Fri Oct 19, 9:57 pm)
Re: 2.6.23-mm1 - autofs broken, Rik van Riel, (Fri Oct 19, 10:13 pm)
Re: oops in lbmIODone, fails to boot [Re: 2.6.23-mm1], Andrew Morton, (Fri Oct 19, 10:34 pm)
Re: 2.6.23-mm1 - autofs broken, Andrew Morton, (Fri Oct 19, 10:39 pm)
Re: 2.6.23-mm1 - autofs broken, Rik van Riel, (Fri Oct 19, 10:54 pm)
Re: 2.6.23-mm1 - autofs broken, Rik van Riel, (Fri Oct 19, 10:54 pm)
Re: oops in lbmIODone, fails to boot [Re: 2.6.23-mm1], Dave Kleikamp, (Sat Oct 20, 5:18 am)
Re: 2.6.23-mm1 - autofs broken, Rik van Riel, (Sat Oct 20, 7:56 am)
Re: oops in lbmIODone, fails to boot [Re: 2.6.23-mm1], Mattia Dongili, (Sat Oct 20, 10:44 pm)
mysqld prevents s2ram [Re: 2.6.23-mm1], Mattia Dongili, (Sat Oct 20, 10:58 pm)
Re: mysqld prevents s2ram [Re: 2.6.23-mm1], Mattia Dongili, (Sat Oct 20, 11:28 pm)
Re: 2.6.23-mm1 - regression- PowerPC link failure at arch/ ..., Kamalesh Babulal, (Sat Oct 20, 11:42 pm)
Re: mysqld prevents s2ram [Re: 2.6.23-mm1], Pavel Machek, (Sun Oct 21, 2:58 am)
Re: mysqld prevents s2ram [Re: 2.6.23-mm1], Rafael J. Wysocki, (Sun Oct 21, 4:53 am)
Re: 2.6.23-mm1 - autofs broken, Ian Kent, (Sun Oct 21, 8:45 pm)
Re: 2.6.23-mm1 - autofs broken, Rik van Riel, (Mon Oct 22, 9:46 am)
kernel panic when running tcpdump, Mariusz Kozlowski, (Mon Oct 22, 11:40 am)
Re: kernel panic when running tcpdump, Andrew Morton, (Mon Oct 22, 12:03 pm)
Re: kernel panic when running tcpdump, Mariusz Kozlowski, (Mon Oct 22, 2:16 pm)
Re: 2.6.23-mm1 - autofs broken, Dave Hansen, (Mon Oct 22, 3:03 pm)
Re: 2.6.23-mm1 - regression- PowerPC link failure at arch/ ..., Stephen Rothwell, (Fri Oct 26, 10:05 pm)
Re: [2.6.23-mm1] CONFIG_LOCALVERSION handling broken, Tilman Schmidt, (Sat Oct 27, 8:19 am)
Re: [2.6.23-mm1] CONFIG_LOCALVERSION handling broken, Sam Ravnborg, (Sat Oct 27, 8:28 am)