Skip to contentSkip to conversation

Fix build failure in recent pm_prepare_* changes.

PATCH Olaf Hering 5 participants 10 messages Feb 5, 2006 – Feb 7, 2006 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines · Linux Kernel Mailing List

tree 8f70444139c8564c0f1e88e1f33adda036ae6a96
parent 278ff9537030bbb292b33504f5e1f6e0126793eb
author Dave Jones <[email protected]> Fri, 03 Feb 2006 19:03:44 -0800 committer Linus Torvalds <[email protected]> Sat, 04 Feb 2006 00:32:00 -0800

Quoted 8 lines

[PATCH] Fix build failure in recent pm_prepare_* changes.

kernel/power/power.h:49: error: static declaration of 'pm_prepare_console' follows non-static declaration include/linux/suspend.h:46: error: previous declaration of 'pm_prepare_console' was here kernel/power/power.h:50: error: static declaration of 'pm_restore_console' follows non-static declaration include/linux/suspend.h:47: error: previous declaration of 'pm_restore_console' was here

this one is not correct, please have a closer look at f7b8988ff50d99c99746f65f420364e91362c065

CC drivers/macintosh/via-pmu.o
drivers/macintosh/via-pmu.c: In function 'pmac_suspend_devices':
drivers/macintosh/via-pmu.c:2078: error: implicit declaration of function 'pm_prepare_console' drivers/macintosh/via-pmu.c: In function 'pmac_wakeup_devices':
drivers/macintosh/via-pmu.c:2194: error: implicit declaration of function 'pm_restore_console' make[2]: *** [drivers/macintosh/via-pmu.o] Error 1

Signature · 2 lines
short story of a lazy sysadmin:
 alias appserv=wotan
#2 lore raw
Quoted 19 lines · Olaf Hering
Quoted 5 lines · Linux Kernel Mailing List

tree 8f70444139c8564c0f1e88e1f33adda036ae6a96
parent 278ff9537030bbb292b33504f5e1f6e0126793eb
author Dave Jones <[email protected]> Fri, 03 Feb 2006 19:03:44 -0800 committer Linus Torvalds <[email protected]> Sat, 04 Feb 2006 00:32:00 -0800

Quoted 8 lines

[PATCH] Fix build failure in recent pm_prepare_* changes.

kernel/power/power.h:49: error: static declaration of 'pm_prepare_console' follows non-static declaration include/linux/suspend.h:46: error: previous declaration of 'pm_prepare_console' was here kernel/power/power.h:50: error: static declaration of 'pm_restore_console' follows non-static declaration include/linux/suspend.h:47: error: previous declaration of 'pm_restore_console' was here

this one is not correct, please have a closer look at f7b8988ff50d99c99746f65f420364e91362c065

Quoted 6 lines

CC drivers/macintosh/via-pmu.o
drivers/macintosh/via-pmu.c: In function 'pmac_suspend_devices':
drivers/macintosh/via-pmu.c:2078: error: implicit declaration of function 'pm_prepare_console' drivers/macintosh/via-pmu.c: In function 'pmac_wakeup_devices':
drivers/macintosh/via-pmu.c:2194: error: implicit declaration of function 'pm_restore_console' make[2]: *** [drivers/macintosh/via-pmu.o] Error 1

Strange, my ppc[64] builds compiled and linked without failure. I think perhaps it's time I added -Werror-implicit-function-declaration to the Makefile.

I'll not get a chance to look into fixing this until tomorrow, so if Rafael/Pavel have time before then, maybe they'll beat me to it.

Dave

#3 lore raw
Quoted 27 lines · Dave Jones
Quoted 19 lines · Olaf Hering
Quoted 5 lines · Linux Kernel Mailing List

tree 8f70444139c8564c0f1e88e1f33adda036ae6a96
parent 278ff9537030bbb292b33504f5e1f6e0126793eb
author Dave Jones <[email protected]> Fri, 03 Feb 2006 19:03:44 -0800 committer Linus Torvalds <[email protected]> Sat, 04 Feb 2006 00:32:00 -0800

Quoted 8 lines

[PATCH] Fix build failure in recent pm_prepare_* changes.

kernel/power/power.h:49: error: static declaration of 'pm_prepare_console' follows non-static declaration include/linux/suspend.h:46: error: previous declaration of 'pm_prepare_console' was here kernel/power/power.h:50: error: static declaration of 'pm_restore_console' follows non-static declaration include/linux/suspend.h:47: error: previous declaration of 'pm_restore_console' was here

this one is not correct, please have a closer look at f7b8988ff50d99c99746f65f420364e91362c065

Quoted 6 lines

CC drivers/macintosh/via-pmu.o
drivers/macintosh/via-pmu.c: In function 'pmac_suspend_devices':
drivers/macintosh/via-pmu.c:2078: error: implicit declaration of function 'pm_prepare_console' drivers/macintosh/via-pmu.c: In function 'pmac_wakeup_devices':
drivers/macintosh/via-pmu.c:2194: error: implicit declaration of function 'pm_restore_console' make[2]: *** [drivers/macintosh/via-pmu.o] Error 1

Quoted 3 lines

Strange, my ppc[64] builds compiled and linked without failure. I think perhaps it's time I added -Werror-implicit-function-declaration to the Makefile.
...

If it compiles and links and gcc guessed the prototype correctly everything is fine. If it compiles and links and gcc guessed the prototype wrongly, you have a hard to find runtime error...

I'd love to add this flag to the global Makefile, but Andrew always rejected it because it turns link errors into compile errors (sic) breaking his powerpc all*config builds due to virt_to_bus/bus_to_virt. But then he rejected to mark virt_to_bus/bus_to_virt as __deprecated on i386 because it currently generates some warnings... :-(

Quoted 1 line

Dave

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#4 lore raw
In reply to Dave Jones
Quoted 20 lines · Dave Jones
Quoted 19 lines · Olaf Hering
Quoted 5 lines · Linux Kernel Mailing List

tree 8f70444139c8564c0f1e88e1f33adda036ae6a96
parent 278ff9537030bbb292b33504f5e1f6e0126793eb
author Dave Jones <[email protected]> Fri, 03 Feb 2006 19:03:44 -0800 committer Linus Torvalds <[email protected]> Sat, 04 Feb 2006 00:32:00 -0800

Quoted 8 lines

[PATCH] Fix build failure in recent pm_prepare_* changes.

kernel/power/power.h:49: error: static declaration of 'pm_prepare_console' follows non-static declaration include/linux/suspend.h:46: error: previous declaration of 'pm_prepare_console' was here kernel/power/power.h:50: error: static declaration of 'pm_restore_console' follows non-static declaration include/linux/suspend.h:47: error: previous declaration of 'pm_restore_console' was here

this one is not correct, please have a closer look at f7b8988ff50d99c99746f65f420364e91362c065

Quoted 6 lines
Quoted 6 lines

CC drivers/macintosh/via-pmu.o
drivers/macintosh/via-pmu.c: In function 'pmac_suspend_devices':
drivers/macintosh/via-pmu.c:2078: error: implicit declaration of function 'pm_prepare_console' drivers/macintosh/via-pmu.c: In function 'pmac_wakeup_devices':
drivers/macintosh/via-pmu.c:2194: error: implicit declaration of function 'pm_restore_console' make[2]: *** [drivers/macintosh/via-pmu.o] Error 1

Ben, does via-pmu still need the pm_prepare_console call? If yes, the declaration has to be moved from kernel/power/power.h to include/linux/suspend.h

Signature · 2 lines
short story of a lazy sysadmin:
 alias appserv=wotan
#5 lore raw
Quoted 22 lines · Olaf Hering
Quoted 20 lines · Dave Jones
Quoted 19 lines · Olaf Hering
Quoted 5 lines · Linux Kernel Mailing List

tree 8f70444139c8564c0f1e88e1f33adda036ae6a96
parent 278ff9537030bbb292b33504f5e1f6e0126793eb
author Dave Jones <[email protected]> Fri, 03 Feb 2006 19:03:44 -0800 committer Linus Torvalds <[email protected]> Sat, 04 Feb 2006 00:32:00 -0800

Quoted 8 lines

[PATCH] Fix build failure in recent pm_prepare_* changes.

kernel/power/power.h:49: error: static declaration of 'pm_prepare_console' follows non-static declaration include/linux/suspend.h:46: error: previous declaration of 'pm_prepare_console' was here kernel/power/power.h:50: error: static declaration of 'pm_restore_console' follows non-static declaration include/linux/suspend.h:47: error: previous declaration of 'pm_restore_console' was here

this one is not correct, please have a closer look at f7b8988ff50d99c99746f65f420364e91362c065

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

CC drivers/macintosh/via-pmu.o
drivers/macintosh/via-pmu.c: In function 'pmac_suspend_devices':
drivers/macintosh/via-pmu.c:2078: error: implicit declaration of function 'pm_prepare_console' drivers/macintosh/via-pmu.c: In function 'pmac_wakeup_devices':
drivers/macintosh/via-pmu.c:2194: error: implicit declaration of function 'pm_restore_console' make[2]: *** [drivers/macintosh/via-pmu.o] Error 1

via-pmu needs to call console functions directly from the pmu_ioctl.

 drivers/macintosh/via-pmu.c |    4 ++++
 1 files changed, 4 insertions(+)
drivers/macintosh/via-pmu.c +4 -0
Index: linux-2.6.16-rc2-olh/drivers/macintosh/via-pmu.c
===================================================================
@@ -2070,6 +2070,10 @@ restore_via_state(void)
 	out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
 }
 
+/* to avoid include mess */
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+
 static int
 pmac_suspend_devices(void)
 {
Signature · 2 lines
short story of a lazy sysadmin:
 alias appserv=wotan
#6 lore raw

Hi,

Quoted 12 lines · Olaf Hering
Quoted 10 lines · Olaf Hering
Quoted 8 lines · Dave Jones
Quoted 7 lines · Olaf Hering
Quoted 5 lines · Linux Kernel Mailing List

tree 8f70444139c8564c0f1e88e1f33adda036ae6a96
parent 278ff9537030bbb292b33504f5e1f6e0126793eb
author Dave Jones <[email protected]> Fri, 03 Feb 2006 19:03:44 -0800 committer Linus Torvalds <[email protected]> Sat, 04 Feb 2006 00:32:00 -0800

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

[PATCH] Fix build failure in recent pm_prepare_* changes.

kernel/power/power.h:49: error: static declaration of 'pm_prepare_console' follows non-static declaration include/linux/suspend.h:46: error: previous declaration of 'pm_prepare_console' was here kernel/power/power.h:50: error: static declaration of 'pm_restore_console' follows non-static declaration include/linux/suspend.h:47: error: previous declaration of 'pm_restore_console' was here

Sorry, my recent change has broken it, but pm_prepare_console() and pm_restore_console() are only static if CONFIG_VT or CONFIG_VT_CONSOLE is not set which Ben told me should not happen on Macs.

Quoted 25 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

this one is not correct, please have a closer look at f7b8988ff50d99c99746f65f420364e91362c065

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

CC drivers/macintosh/via-pmu.o
drivers/macintosh/via-pmu.c: In function 'pmac_suspend_devices':
drivers/macintosh/via-pmu.c:2078: error: implicit declaration of function 'pm_prepare_console' drivers/macintosh/via-pmu.c: In function 'pmac_wakeup_devices':
drivers/macintosh/via-pmu.c:2194: error: implicit declaration of function 'pm_restore_console' make[2]: *** [drivers/macintosh/via-pmu.o] Error 1

via-pmu needs to call console functions directly from the pmu_ioctl.

 drivers/macintosh/via-pmu.c |    4 ++++
 1 files changed, 4 insertions(+)

Index: linux-2.6.16-rc2-olh/drivers/macintosh/via-pmu.c
===================================================================

drivers/macintosh/via-pmu.c restore_via_state(void) · line 2075

Quoted 6 lines
drivers/macintosh/via-pmu.c +3 -0
@@ -2070,6 +2070,10 @@ restore_via_state(void)
 	out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
 }
 
+/* to avoid include mess */
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);

if CONFIG_VT or CONFIG_VT_CONSOLE is not set, these functions are not defined.

drivers/macintosh/via-pmu.c restore_via_state(void) · line 2079

Quoted 5 lines
drivers/macintosh/via-pmu.c +1 -0
+
 static int
 pmac_suspend_devices(void)
 {

I think the complete fix should look like that:

drivers/macintosh/via-pmu.c +8 -0
@@ -2070,6 +2070,14 @@ restore_via_state(void)
 	out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
 }
 
+#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+#else
+static int pm_prepare_console(void) { return 0; }
+static void pm_restore_console(void) {}
+#endif
+
 static int
 pmac_suspend_devices(void)
 {

Greetings,
Rafael

#7 lore raw
Quoted 4 lines · Rafael J. Wysocki

Sorry, my recent change has broken it, but pm_prepare_console() and pm_restore_console() are only static if CONFIG_VT or CONFIG_VT_CONSOLE is not set which Ben told me should not happen on Macs.

But kernel/power/power.h has

#ifdef SUSPEND_CONSOLE
extern int pm_prepare_console(void);
extern void pm_restore_console(void);
#else
static int pm_prepare_console(void) { return 0; }
static void pm_restore_console(void) {}
#endif

Quoted 4 lines
drivers/macintosh/via-pmu.c +0 -0
@@ -2070,6 +2070,14 @@ restore_via_state(void)
 	out_8(&via[IER], IER_SET | SR_INT | CB1_INT);

drivers/macintosh/via-pmu.c restore_via_state(void) · line 2080

Quoted 10 lines
drivers/macintosh/via-pmu.c +8 -0
 }
 
+#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+#else
+static int pm_prepare_console(void) { return 0; }
+static void pm_restore_console(void) {}
+#endif
+

These should be in a header file. Presumably one which kernel/power/power.h includes, too.

#8 lore raw
Quoted 9 lines · Andrew Morton
Quoted 4 lines · Rafael J. Wysocki

Sorry, my recent change has broken it, but pm_prepare_console() and pm_restore_console() are only static if CONFIG_VT or CONFIG_VT_CONSOLE is not set which Ben told me should not happen on Macs.

But kernel/power/power.h has

#ifdef SUSPEND_CONSOLE

There is

#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
#endif

earlier in there.

Quoted 13 lines

extern int pm_prepare_console(void);
extern void pm_restore_console(void);
#else
static int pm_prepare_console(void) { return 0; }
static void pm_restore_console(void) {}
#endif

Quoted 6 lines
drivers/macintosh/via-pmu.c +0 -0
@@ -2070,6 +2070,14 @@ restore_via_state(void)
 	out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
 }
 
Quoted 11 lines

drivers/macintosh/via-pmu.c restore_via_state(void) · line 2080

Quoted 8 lines
drivers/macintosh/via-pmu.c +8 -0
+#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+#else
+static int pm_prepare_console(void) { return 0; }
+static void pm_restore_console(void) {}
+#endif
+

These should be in a header file. Presumably one which kernel/power/power.h includes, too.

Then I think I should move all that to include/linux/suspend.h.

Greetings,
Rafael

#9 lore raw
Quoted 19 lines · Rafael J. Wysocki
Quoted 7 lines
Quoted 7 lines
drivers/macintosh/via-pmu.c +0 -0
@@ -2070,6 +2070,14 @@ restore_via_state(void)
 	out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
 }
 
Quoted 11 lines

drivers/macintosh/via-pmu.c restore_via_state(void) · line 2080

Quoted 8 lines
drivers/macintosh/via-pmu.c +8 -0
+#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+#else
+static int pm_prepare_console(void) { return 0; }
+static void pm_restore_console(void) {}
+#endif
+

These should be in a header file. Presumably one which kernel/power/power.h includes, too.

Quoted 1 line

Then I think I should move all that to include/linux/suspend.h.

Sounds sane. Or <linux/console.h>.

#10 lore raw
Quoted 20 lines · Andrew Morton
Quoted 19 lines · Rafael J. Wysocki
Quoted 18 lines
Quoted 5 lines
drivers/macintosh/via-pmu.c +0 -0
@@ -2070,6 +2070,14 @@ restore_via_state(void)
 	out_8(&via[IER], IER_SET | SR_INT | CB1_INT);

drivers/macintosh/via-pmu.c restore_via_state(void) · line 2080

Quoted 10 lines
drivers/macintosh/via-pmu.c +8 -0
 }
 
+#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+#else
+static int pm_prepare_console(void) { return 0; }
+static void pm_restore_console(void) {}
+#endif
+

These should be in a header file. Presumably one which kernel/power/power.h includes, too.

Quoted 3 lines
Quoted 1 line

Then I think I should move all that to include/linux/suspend.h.

Sounds sane. Or <linux/console.h>.

I chose include/linux/suspend.h (it was there before and the functions are defined in kernel/power/console.c).

The appended patch (against -mm5) has been compile-tested on x86-64 and i386 with and withoud CONFIG_VT, CONFIG_VT_CONSOLE. [I have no access to a Mac, though.]

Greetings,
Rafael

Fix compilation problem in PM headers.

 include/linux/suspend.h |   10 +++++++++-
 kernel/power/console.c  |    4 +++-
 kernel/power/power.h    |   16 ----------------
 3 files changed, 12 insertions(+), 18 deletions(-)
include/linux/suspend.h +9 -1
Index: linux-2.6.16-rc1-mm5/include/linux/suspend.h
===================================================================
@@ -42,13 +42,21 @@ extern void mark_free_pages(struct zone 
 #ifdef CONFIG_PM
 /* kernel/power/swsusp.c */
 extern int software_suspend(void);
+
+#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+#else
+static inline int pm_prepare_console(void) { return 0; }
+static inline void pm_restore_console(void) {}
+#endif /* defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) */
 #else
 static inline int software_suspend(void)
 {
 	printk("Warning: fake suspend called\n");
 	return -EPERM;
 }
-#endif
+#endif /* CONFIG_PM */
 
 #ifdef CONFIG_SUSPEND_SMP
 extern void disable_nonboot_cpus(void);
kernel/power/power.h +0 -16
Index: linux-2.6.16-rc1-mm5/kernel/power/power.h
===================================================================
@@ -1,14 +1,6 @@
 #include <linux/suspend.h>
 #include <linux/utsname.h>
 
-/* With SUSPEND_CONSOLE defined suspend looks *really* cool, but
-   we probably do not take enough locks for switching consoles, etc,
-   so bad things might happen.
-*/
-#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
-#define SUSPEND_CONSOLE	(MAX_NR_CONSOLES-1)
-#endif
-
 struct swsusp_info {
 	struct new_utsname	uts;
 	u32			version_code;
@@ -43,14 +35,6 @@ static struct subsys_attribute _name##_a
 
 extern struct subsystem power_subsys;
 
-#ifdef SUSPEND_CONSOLE
-extern int pm_prepare_console(void);
-extern void pm_restore_console(void);
-#else
-static int pm_prepare_console(void) { return 0; }
-static void pm_restore_console(void) {}
-#endif
-
 /* References to section boundaries */
 extern const void __nosave_begin, __nosave_end;
 
kernel/power/console.c +3 -1
Index: linux-2.6.16-rc1-mm5/kernel/power/console.c
===================================================================
@@ -9,7 +9,9 @@
 #include <linux/console.h>
 #include "power.h"
 
-#ifdef SUSPEND_CONSOLE
+#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#define SUSPEND_CONSOLE	(MAX_NR_CONSOLES-1)
+
 static int orig_fgconsole, orig_kmsg;
 
 int pm_prepare_console(void)