public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] move pm_power_off and pm_idle declaration to common code
@ 2005-12-12 14:02 Miklos Szeredi
  2005-12-12 14:20 ` Eric W. Biederman
  2005-12-12 15:26 ` [PATCH] uml: fix pm_power_off link failure Miklos Szeredi
  0 siblings, 2 replies; 9+ messages in thread
From: Miklos Szeredi @ 2005-12-12 14:02 UTC (permalink / raw)
  To: akpm; +Cc: ebiederm, linux-kernel

This patch broke UML build (and approx 15 other archs):

  dont-attempt-to-power-off-if-power-off-is-not-implemented.patch

  LD      .tmp_vmlinux1
kernel/built-in.o(.text+0x148e1): In function `sys_reboot':
kernel/sys.c:535: undefined reference to `pm_power_off'

So move declaration of pm_power_off (and with it pm_idle) from the
archs that do define it to kernel/sys.c.  This should fix the link
problem, and at the same time remove some duplication.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
---

Index: linux/kernel/sys.c
===================================================================
--- linux.orig/kernel/sys.c	2005-12-12 12:04:21.000000000 +0100
+++ linux/kernel/sys.c	2005-12-12 13:54:31.000000000 +0100
@@ -97,6 +97,18 @@ int cad_pid = 1;
 static struct notifier_block *reboot_notifier_list;
 static DEFINE_RWLOCK(notifier_lock);
 
+/*
+ * Powermanagement idle function, if any..
+ */
+void (*pm_idle)(void);
+EXPORT_SYMBOL(pm_idle);
+
+/*
+ * Power off function, if any
+ */
+void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);
+
 /**
  *	notifier_chain_register	- Add notifier to a notifier chain
  *	@list: Pointer to root list pointer
Index: linux/arch/frv/kernel/pm.c
===================================================================
--- linux.orig/arch/frv/kernel/pm.c	2005-12-06 14:08:49.000000000 +0100
+++ linux/arch/frv/kernel/pm.c	2005-12-12 13:50:46.000000000 +0100
@@ -26,8 +26,6 @@
 
 #include "local.h"
 
-void (*pm_power_off)(void);
-
 extern void frv_change_cmode(int);
 
 /*
Index: linux/arch/i386/kernel/reboot.c
===================================================================
--- linux.orig/arch/i386/kernel/reboot.c	2005-12-12 12:04:05.000000000 +0100
+++ linux/arch/i386/kernel/reboot.c	2005-12-12 13:51:34.000000000 +0100
@@ -19,12 +19,6 @@
 #include "mach_reboot.h"
 #include <linux/reboot_fixups.h>
 
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
 static int reboot_mode;
 static int reboot_thru_bios;
 
Index: linux/arch/powerpc/kernel/setup-common.c
===================================================================
--- linux.orig/arch/powerpc/kernel/setup-common.c	2005-12-12 12:04:07.000000000 +0100
+++ linux/arch/powerpc/kernel/setup-common.c	2005-12-12 14:30:54.000000000 +0100
@@ -30,6 +30,7 @@
 #include <linux/unistd.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
+#include <linux/pm.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/processor.h>
@@ -124,7 +125,6 @@ void machine_power_off(void)
 EXPORT_SYMBOL_GPL(machine_power_off);
 
 void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL_GPL(pm_power_off);
 
 void machine_halt(void)
 {
Index: linux/arch/sparc/kernel/sparc_ksyms.c
===================================================================
--- linux.orig/arch/sparc/kernel/sparc_ksyms.c	2005-10-28 02:02:08.000000000 +0200
+++ linux/arch/sparc/kernel/sparc_ksyms.c	2005-12-12 14:09:25.000000000 +0100
@@ -324,8 +324,5 @@ EXPORT_SYMBOL(_Udiv);
 EXPORT_SYMBOL(do_BUG);
 #endif
 
-/* Sun Power Management Idle Handler */
-EXPORT_SYMBOL(pm_idle);
-
 /* Binfmt_misc needs this */
 EXPORT_SYMBOL(sys_close);
Index: linux/arch/x86_64/kernel/process.c
===================================================================
--- linux.orig/arch/x86_64/kernel/process.c	2005-12-12 12:04:08.000000000 +0100
+++ linux/arch/x86_64/kernel/process.c	2005-12-12 14:11:05.000000000 +0100
@@ -58,10 +58,6 @@ unsigned long kernel_thread_flags = CLON
 unsigned long boot_option_idle_override = 0;
 EXPORT_SYMBOL(boot_option_idle_override);
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void);
 static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
 
 /*
Index: linux/arch/x86_64/kernel/reboot.c
===================================================================
--- linux.orig/arch/x86_64/kernel/reboot.c	2005-12-12 12:04:08.000000000 +0100
+++ linux/arch/x86_64/kernel/reboot.c	2005-12-12 14:10:41.000000000 +0100
@@ -16,11 +16,6 @@
 #include <asm/tlbflush.h>
 #include <asm/apic.h>
 
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void);
-
 static long no_idt[3];
 static enum { 
 	BOOT_TRIPLE = 't',
Index: linux/arch/parisc/kernel/parisc_ksyms.c
===================================================================
--- linux.orig/arch/parisc/kernel/parisc_ksyms.c	2005-10-28 02:02:08.000000000 +0200
+++ linux/arch/parisc/kernel/parisc_ksyms.c	2005-12-12 14:07:36.000000000 +0100
@@ -48,9 +48,6 @@ EXPORT_SYMBOL(strrchr);
 EXPORT_SYMBOL(strstr);
 EXPORT_SYMBOL(strpbrk);
 
-#include <linux/pm.h>
-EXPORT_SYMBOL(pm_power_off);
-
 #include <asm/atomic.h>
 EXPORT_SYMBOL(__xchg8);
 EXPORT_SYMBOL(__xchg32);
Index: linux/arch/x86_64/kernel/x8664_ksyms.c
===================================================================
--- linux.orig/arch/x86_64/kernel/x8664_ksyms.c	2005-12-06 14:08:50.000000000 +0100
+++ linux/arch/x86_64/kernel/x8664_ksyms.c	2005-12-12 14:20:43.000000000 +0100
@@ -58,8 +58,6 @@ EXPORT_SYMBOL(disable_irq);
 EXPORT_SYMBOL(disable_irq_nosync);
 EXPORT_SYMBOL(probe_irq_mask);
 EXPORT_SYMBOL(kernel_thread);
-EXPORT_SYMBOL(pm_idle);
-EXPORT_SYMBOL(pm_power_off);
 EXPORT_SYMBOL(get_cmos_time);
 
 EXPORT_SYMBOL(__down_failed);
Index: linux/arch/i386/mach-visws/reboot.c
===================================================================
--- linux.orig/arch/i386/mach-visws/reboot.c	2005-10-28 02:02:08.000000000 +0200
+++ linux/arch/i386/mach-visws/reboot.c	2005-12-12 13:56:27.000000000 +0100
@@ -6,9 +6,6 @@
 #include <asm/io.h>
 #include "piix4.h"
 
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
 void machine_shutdown(void)
 {
 #ifdef CONFIG_SMP
Index: linux/arch/ppc/kernel/setup.c
===================================================================
--- linux.orig/arch/ppc/kernel/setup.c	2005-12-12 12:04:07.000000000 +0100
+++ linux/arch/ppc/kernel/setup.c	2005-12-12 14:27:42.000000000 +0100
@@ -18,6 +18,7 @@
 #include <linux/root_dev.h>
 #include <linux/cpu.h>
 #include <linux/console.h>
+#include <linux/pm.h>
 
 #include <asm/residual.h>
 #include <asm/io.h>
Index: linux/arch/sparc/kernel/process.c
===================================================================
--- linux.orig/arch/sparc/kernel/process.c	2005-12-06 14:08:50.000000000 +0100
+++ linux/arch/sparc/kernel/process.c	2005-12-12 14:09:43.000000000 +0100
@@ -43,19 +43,6 @@
 #include <asm/elf.h>
 #include <asm/unistd.h>
 
-/* 
- * Power management idle function 
- * Set in pm platform drivers (apc.c and pmc.c)
- */
-void (*pm_idle)(void);
-
-/* 
- * Power-off handler instantiation for pm.h compliance
- * This is done via auxio, but could be used as a fallback
- * handler when auxio is not present-- unused for now...
- */
-void (*pm_power_off)(void);
-
 /*
  * sysctl - toggle power-off restriction for serial console 
  * systems in machine_power_off()
Index: linux/arch/arm/kernel/process.c
===================================================================
--- linux.orig/arch/arm/kernel/process.c	2005-12-12 13:30:33.000000000 +0100
+++ linux/arch/arm/kernel/process.c	2005-12-12 13:32:14.000000000 +0100
@@ -27,6 +27,7 @@
 #include <linux/kallsyms.h>
 #include <linux/init.h>
 #include <linux/cpu.h>
+#include <linux/pm.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -72,15 +73,6 @@ __setup("nohlt", nohlt_setup);
 __setup("hlt", hlt_setup);
 
 /*
- * The following aren't currently used.
- */
-void (*pm_idle)(void);
-EXPORT_SYMBOL(pm_idle);
-
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
  * This is our default idle handler.  We need to disable
  * interrupts here to ensure we don't miss a wakeup call.
  */
Index: linux/arch/ia64/kernel/acpi.c
===================================================================
--- linux.orig/arch/ia64/kernel/acpi.c	2005-12-06 14:08:49.000000000 +0100
+++ linux/arch/ia64/kernel/acpi.c	2005-12-12 14:04:09.000000000 +0100
@@ -60,11 +60,6 @@
 
 #define PREFIX			"ACPI: "
 
-void (*pm_idle) (void);
-EXPORT_SYMBOL(pm_idle);
-void (*pm_power_off) (void);
-EXPORT_SYMBOL(pm_power_off);
-
 unsigned char acpi_kbd_controller_present = 1;
 unsigned char acpi_legacy_devices;
 
Index: linux/arch/ppc/kernel/ppc_ksyms.c
===================================================================
--- linux.orig/arch/ppc/kernel/ppc_ksyms.c	2005-12-12 12:04:07.000000000 +0100
+++ linux/arch/ppc/kernel/ppc_ksyms.c	2005-12-12 14:02:30.000000000 +0100
@@ -249,8 +249,6 @@ EXPORT_SYMBOL(kd_mksound);
 #endif
 EXPORT_SYMBOL(to_tm);
 
-EXPORT_SYMBOL(pm_power_off);
-
 EXPORT_SYMBOL(__ashrdi3);
 EXPORT_SYMBOL(__ashldi3);
 EXPORT_SYMBOL(__lshrdi3);
Index: linux/arch/i386/kernel/process.c
===================================================================
--- linux.orig/arch/i386/kernel/process.c	2005-12-12 12:04:05.000000000 +0100
+++ linux/arch/i386/kernel/process.c	2005-12-12 13:56:05.000000000 +0100
@@ -39,6 +39,7 @@
 #include <linux/ptrace.h>
 #include <linux/random.h>
 #include <linux/kprobes.h>
+#include <linux/pm.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -72,11 +73,6 @@ unsigned long thread_saved_pc(struct tas
 	return ((unsigned long *)tsk->thread.esp)[3];
 }
 
-/*
- * Powermanagement idle function, if any..
- */
-void (*pm_idle)(void);
-EXPORT_SYMBOL(pm_idle);
 static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
 
 void disable_hlt(void)
Index: linux/arch/parisc/kernel/process.c
===================================================================
--- linux.orig/arch/parisc/kernel/process.c	2005-12-06 14:08:50.000000000 +0100
+++ linux/arch/parisc/kernel/process.c	2005-12-12 14:06:52.000000000 +0100
@@ -45,6 +45,7 @@
 #include <linux/stddef.h>
 #include <linux/unistd.h>
 #include <linux/kallsyms.h>
+#include <linux/pm.h>
 
 #include <asm/io.h>
 #include <asm/asm-offsets.h>
@@ -56,11 +57,6 @@
 
 static int hlt_counter;
 
-/*
- * Power off function, if any
- */ 
-void (*pm_power_off)(void);
-
 void disable_hlt(void)
 {
 	hlt_counter++;
Index: linux/arch/i386/mach-voyager/voyager_basic.c
===================================================================
--- linux.orig/arch/i386/mach-voyager/voyager_basic.c	2005-10-28 02:02:08.000000000 +0200
+++ linux/arch/i386/mach-voyager/voyager_basic.c	2005-12-12 13:56:52.000000000 +0100
@@ -31,12 +31,6 @@
 #include <asm/arch_hooks.h>
 #include <asm/i8253.h>
 
-/*
- * Power off function, if any
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
 int voyager_level = 0;
 
 struct voyager_SUS *voyager_SUS = NULL;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] move pm_power_off and pm_idle declaration to common code
  2005-12-12 14:02 [PATCH] move pm_power_off and pm_idle declaration to common code Miklos Szeredi
@ 2005-12-12 14:20 ` Eric W. Biederman
  2005-12-12 14:28   ` Miklos Szeredi
  2005-12-12 15:58   ` Paul Jackson
  2005-12-12 15:26 ` [PATCH] uml: fix pm_power_off link failure Miklos Szeredi
  1 sibling, 2 replies; 9+ messages in thread
From: Eric W. Biederman @ 2005-12-12 14:20 UTC (permalink / raw)
  To: Miklos Szeredi
  Cc: akpm, linux-kernel, Paul Jackson, rth, davej, zwane, ak,
	ashok.raj

Miklos Szeredi <miklos@szeredi.hu> writes:

> This patch broke UML build (and approx 15 other archs):
>
>   dont-attempt-to-power-off-if-power-off-is-not-implemented.patch
>
>   LD      .tmp_vmlinux1
> kernel/built-in.o(.text+0x148e1): In function `sys_reboot':
> kernel/sys.c:535: undefined reference to `pm_power_off'
>
> So move declaration of pm_power_off (and with it pm_idle) from the
> archs that do define it to kernel/sys.c.  This should fix the link
> problem, and at the same time remove some duplication.

Sounds sane.  

Does powerpc still build?  A key question is how do we handle architectures
that always want to want to call machine_power_off.

If they can declare a static initializer like powerpc does that problem
is largely solved.  If we can't do something simple like that we
still need to solve that case.

Eric
>
> Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
> ---
>
> Index: linux/kernel/sys.c
> ===================================================================
> --- linux.orig/kernel/sys.c	2005-12-12 12:04:21.000000000 +0100
> +++ linux/kernel/sys.c	2005-12-12 13:54:31.000000000 +0100
> @@ -97,6 +97,18 @@ int cad_pid = 1;
>  static struct notifier_block *reboot_notifier_list;
>  static DEFINE_RWLOCK(notifier_lock);
>  
> +/*
> + * Powermanagement idle function, if any..
> + */
> +void (*pm_idle)(void);
> +EXPORT_SYMBOL(pm_idle);
> +
> +/*
> + * Power off function, if any
> + */
> +void (*pm_power_off)(void);
> +EXPORT_SYMBOL(pm_power_off);
> +
>  /**
>   *	notifier_chain_register	- Add notifier to a notifier chain
>   *	@list: Pointer to root list pointer
> Index: linux/arch/frv/kernel/pm.c
> ===================================================================
> --- linux.orig/arch/frv/kernel/pm.c	2005-12-06 14:08:49.000000000 +0100
> +++ linux/arch/frv/kernel/pm.c	2005-12-12 13:50:46.000000000 +0100
> @@ -26,8 +26,6 @@
>  
>  #include "local.h"
>  
> -void (*pm_power_off)(void);
> -
>  extern void frv_change_cmode(int);
>  
>  /*
> Index: linux/arch/i386/kernel/reboot.c
> ===================================================================
> --- linux.orig/arch/i386/kernel/reboot.c 2005-12-12 12:04:05.000000000 +0100
> +++ linux/arch/i386/kernel/reboot.c	2005-12-12 13:51:34.000000000 +0100
> @@ -19,12 +19,6 @@
>  #include "mach_reboot.h"
>  #include <linux/reboot_fixups.h>
>  
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  static int reboot_mode;
>  static int reboot_thru_bios;
>  
> Index: linux/arch/powerpc/kernel/setup-common.c
> ===================================================================
> --- linux.orig/arch/powerpc/kernel/setup-common.c 2005-12-12 12:04:07.000000000
> +0100
> +++ linux/arch/powerpc/kernel/setup-common.c 2005-12-12 14:30:54.000000000 +0100
> @@ -30,6 +30,7 @@
>  #include <linux/unistd.h>
>  #include <linux/serial.h>
>  #include <linux/serial_8250.h>
> +#include <linux/pm.h>
>  #include <asm/io.h>
>  #include <asm/prom.h>
>  #include <asm/processor.h>
> @@ -124,7 +125,6 @@ void machine_power_off(void)
>  EXPORT_SYMBOL_GPL(machine_power_off);
>  
>  void (*pm_power_off)(void) = machine_power_off;
> -EXPORT_SYMBOL_GPL(pm_power_off);
>  
>  void machine_halt(void)
>  {
> Index: linux/arch/sparc/kernel/sparc_ksyms.c
> ===================================================================
> --- linux.orig/arch/sparc/kernel/sparc_ksyms.c 2005-10-28 02:02:08.000000000
> +0200
> +++ linux/arch/sparc/kernel/sparc_ksyms.c 2005-12-12 14:09:25.000000000 +0100
> @@ -324,8 +324,5 @@ EXPORT_SYMBOL(_Udiv);
>  EXPORT_SYMBOL(do_BUG);
>  #endif
>  
> -/* Sun Power Management Idle Handler */
> -EXPORT_SYMBOL(pm_idle);
> -
>  /* Binfmt_misc needs this */
>  EXPORT_SYMBOL(sys_close);
> Index: linux/arch/x86_64/kernel/process.c
> ===================================================================
> --- linux.orig/arch/x86_64/kernel/process.c 2005-12-12 12:04:08.000000000 +0100
> +++ linux/arch/x86_64/kernel/process.c	2005-12-12 14:11:05.000000000 +0100
> @@ -58,10 +58,6 @@ unsigned long kernel_thread_flags = CLON
>  unsigned long boot_option_idle_override = 0;
>  EXPORT_SYMBOL(boot_option_idle_override);
>  
> -/*
> - * Powermanagement idle function, if any..
> - */
> -void (*pm_idle)(void);
>  static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
>  
>  /*
> Index: linux/arch/x86_64/kernel/reboot.c
> ===================================================================
> --- linux.orig/arch/x86_64/kernel/reboot.c 2005-12-12 12:04:08.000000000 +0100
> +++ linux/arch/x86_64/kernel/reboot.c	2005-12-12 14:10:41.000000000 +0100
> @@ -16,11 +16,6 @@
>  #include <asm/tlbflush.h>
>  #include <asm/apic.h>
>  
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void);
> -
>  static long no_idt[3];
>  static enum { 
>  	BOOT_TRIPLE = 't',
> Index: linux/arch/parisc/kernel/parisc_ksyms.c
> ===================================================================
> --- linux.orig/arch/parisc/kernel/parisc_ksyms.c 2005-10-28 02:02:08.000000000
> +0200
> +++ linux/arch/parisc/kernel/parisc_ksyms.c 2005-12-12 14:07:36.000000000 +0100
> @@ -48,9 +48,6 @@ EXPORT_SYMBOL(strrchr);
>  EXPORT_SYMBOL(strstr);
>  EXPORT_SYMBOL(strpbrk);
>  
> -#include <linux/pm.h>
> -EXPORT_SYMBOL(pm_power_off);
> -
>  #include <asm/atomic.h>
>  EXPORT_SYMBOL(__xchg8);
>  EXPORT_SYMBOL(__xchg32);
> Index: linux/arch/x86_64/kernel/x8664_ksyms.c
> ===================================================================
> --- linux.orig/arch/x86_64/kernel/x8664_ksyms.c 2005-12-06 14:08:50.000000000
> +0100
> +++ linux/arch/x86_64/kernel/x8664_ksyms.c 2005-12-12 14:20:43.000000000 +0100
> @@ -58,8 +58,6 @@ EXPORT_SYMBOL(disable_irq);
>  EXPORT_SYMBOL(disable_irq_nosync);
>  EXPORT_SYMBOL(probe_irq_mask);
>  EXPORT_SYMBOL(kernel_thread);
> -EXPORT_SYMBOL(pm_idle);
> -EXPORT_SYMBOL(pm_power_off);
>  EXPORT_SYMBOL(get_cmos_time);
>  
>  EXPORT_SYMBOL(__down_failed);
> Index: linux/arch/i386/mach-visws/reboot.c
> ===================================================================
> --- linux.orig/arch/i386/mach-visws/reboot.c 2005-10-28 02:02:08.000000000 +0200
> +++ linux/arch/i386/mach-visws/reboot.c	2005-12-12 13:56:27.000000000 +0100
> @@ -6,9 +6,6 @@
>  #include <asm/io.h>
>  #include "piix4.h"
>  
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  void machine_shutdown(void)
>  {
>  #ifdef CONFIG_SMP
> Index: linux/arch/ppc/kernel/setup.c
> ===================================================================
> --- linux.orig/arch/ppc/kernel/setup.c	2005-12-12 12:04:07.000000000 +0100
> +++ linux/arch/ppc/kernel/setup.c	2005-12-12 14:27:42.000000000 +0100
> @@ -18,6 +18,7 @@
>  #include <linux/root_dev.h>
>  #include <linux/cpu.h>
>  #include <linux/console.h>
> +#include <linux/pm.h>
>  
>  #include <asm/residual.h>
>  #include <asm/io.h>
> Index: linux/arch/sparc/kernel/process.c
> ===================================================================
> --- linux.orig/arch/sparc/kernel/process.c 2005-12-06 14:08:50.000000000 +0100
> +++ linux/arch/sparc/kernel/process.c	2005-12-12 14:09:43.000000000 +0100
> @@ -43,19 +43,6 @@
>  #include <asm/elf.h>
>  #include <asm/unistd.h>
>  
> -/* 
> - * Power management idle function 
> - * Set in pm platform drivers (apc.c and pmc.c)
> - */
> -void (*pm_idle)(void);
> -
> -/* 
> - * Power-off handler instantiation for pm.h compliance
> - * This is done via auxio, but could be used as a fallback
> - * handler when auxio is not present-- unused for now...
> - */
> -void (*pm_power_off)(void);
> -
>  /*
>   * sysctl - toggle power-off restriction for serial console 
>   * systems in machine_power_off()
> Index: linux/arch/arm/kernel/process.c
> ===================================================================
> --- linux.orig/arch/arm/kernel/process.c 2005-12-12 13:30:33.000000000 +0100
> +++ linux/arch/arm/kernel/process.c	2005-12-12 13:32:14.000000000 +0100
> @@ -27,6 +27,7 @@
>  #include <linux/kallsyms.h>
>  #include <linux/init.h>
>  #include <linux/cpu.h>
> +#include <linux/pm.h>
>  
>  #include <asm/system.h>
>  #include <asm/io.h>
> @@ -72,15 +73,6 @@ __setup("nohlt", nohlt_setup);
>  __setup("hlt", hlt_setup);
>  
>  /*
> - * The following aren't currently used.
> - */
> -void (*pm_idle)(void);
> -EXPORT_SYMBOL(pm_idle);
> -
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
> -/*
>   * This is our default idle handler.  We need to disable
>   * interrupts here to ensure we don't miss a wakeup call.
>   */
> Index: linux/arch/ia64/kernel/acpi.c
> ===================================================================
> --- linux.orig/arch/ia64/kernel/acpi.c	2005-12-06 14:08:49.000000000 +0100
> +++ linux/arch/ia64/kernel/acpi.c	2005-12-12 14:04:09.000000000 +0100
> @@ -60,11 +60,6 @@
>  
>  #define PREFIX			"ACPI: "
>  
> -void (*pm_idle) (void);
> -EXPORT_SYMBOL(pm_idle);
> -void (*pm_power_off) (void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  unsigned char acpi_kbd_controller_present = 1;
>  unsigned char acpi_legacy_devices;
>  
> Index: linux/arch/ppc/kernel/ppc_ksyms.c
> ===================================================================
> --- linux.orig/arch/ppc/kernel/ppc_ksyms.c 2005-12-12 12:04:07.000000000 +0100
> +++ linux/arch/ppc/kernel/ppc_ksyms.c	2005-12-12 14:02:30.000000000 +0100
> @@ -249,8 +249,6 @@ EXPORT_SYMBOL(kd_mksound);
>  #endif
>  EXPORT_SYMBOL(to_tm);
>  
> -EXPORT_SYMBOL(pm_power_off);
> -
>  EXPORT_SYMBOL(__ashrdi3);
>  EXPORT_SYMBOL(__ashldi3);
>  EXPORT_SYMBOL(__lshrdi3);
> Index: linux/arch/i386/kernel/process.c
> ===================================================================
> --- linux.orig/arch/i386/kernel/process.c 2005-12-12 12:04:05.000000000 +0100
> +++ linux/arch/i386/kernel/process.c	2005-12-12 13:56:05.000000000 +0100
> @@ -39,6 +39,7 @@
>  #include <linux/ptrace.h>
>  #include <linux/random.h>
>  #include <linux/kprobes.h>
> +#include <linux/pm.h>
>  
>  #include <asm/uaccess.h>
>  #include <asm/pgtable.h>
> @@ -72,11 +73,6 @@ unsigned long thread_saved_pc(struct tas
>  	return ((unsigned long *)tsk->thread.esp)[3];
>  }
>  
> -/*
> - * Powermanagement idle function, if any..
> - */
> -void (*pm_idle)(void);
> -EXPORT_SYMBOL(pm_idle);
>  static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
>  
>  void disable_hlt(void)
> Index: linux/arch/parisc/kernel/process.c
> ===================================================================
> --- linux.orig/arch/parisc/kernel/process.c 2005-12-06 14:08:50.000000000 +0100
> +++ linux/arch/parisc/kernel/process.c	2005-12-12 14:06:52.000000000 +0100
> @@ -45,6 +45,7 @@
>  #include <linux/stddef.h>
>  #include <linux/unistd.h>
>  #include <linux/kallsyms.h>
> +#include <linux/pm.h>
>  
>  #include <asm/io.h>
>  #include <asm/asm-offsets.h>
> @@ -56,11 +57,6 @@
>  
>  static int hlt_counter;
>  
> -/*
> - * Power off function, if any
> - */ 
> -void (*pm_power_off)(void);
> -
>  void disable_hlt(void)
>  {
>  	hlt_counter++;
> Index: linux/arch/i386/mach-voyager/voyager_basic.c
> ===================================================================
> --- linux.orig/arch/i386/mach-voyager/voyager_basic.c 2005-10-28
> 02:02:08.000000000 +0200
> +++ linux/arch/i386/mach-voyager/voyager_basic.c 2005-12-12 13:56:52.000000000
> +0100
> @@ -31,12 +31,6 @@
>  #include <asm/arch_hooks.h>
>  #include <asm/i8253.h>
>  
> -/*
> - * Power off function, if any
> - */
> -void (*pm_power_off)(void);
> -EXPORT_SYMBOL(pm_power_off);
> -
>  int voyager_level = 0;
>  
>  struct voyager_SUS *voyager_SUS = NULL;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] move pm_power_off and pm_idle declaration to common code
  2005-12-12 14:20 ` Eric W. Biederman
@ 2005-12-12 14:28   ` Miklos Szeredi
  2005-12-12 14:36     ` Eric W. Biederman
  2005-12-12 14:39     ` Andreas Schwab
  2005-12-12 15:58   ` Paul Jackson
  1 sibling, 2 replies; 9+ messages in thread
From: Miklos Szeredi @ 2005-12-12 14:28 UTC (permalink / raw)
  To: ebiederm; +Cc: akpm, linux-kernel, pj, rth, davej, zwane, ak, ashok.raj

> > So move declaration of pm_power_off (and with it pm_idle) from the
> > archs that do define it to kernel/sys.c.  This should fix the link
> > problem, and at the same time remove some duplication.
> 
> Sounds sane.  
> 
> Does powerpc still build?  A key question is how do we handle architectures
> that always want to want to call machine_power_off.

I didn't (and can't) check, but it should.  IIRC multiple declaration
of a variable is OK, as long as at most one has an initializer.

Miklos

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] move pm_power_off and pm_idle declaration to common code
  2005-12-12 14:28   ` Miklos Szeredi
@ 2005-12-12 14:36     ` Eric W. Biederman
  2005-12-12 14:39     ` Andreas Schwab
  1 sibling, 0 replies; 9+ messages in thread
From: Eric W. Biederman @ 2005-12-12 14:36 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: akpm, linux-kernel, pj, rth, davej, zwane, ak, ashok.raj

Miklos Szeredi <miklos@szeredi.hu> writes:

>> > So move declaration of pm_power_off (and with it pm_idle) from the
>> > archs that do define it to kernel/sys.c.  This should fix the link
>> > problem, and at the same time remove some duplication.
>> 
>> Sounds sane.  
>> 
>> Does powerpc still build?  A key question is how do we handle architectures
>> that always want to want to call machine_power_off.
>
> I didn't (and can't) check, but it should.  IIRC multiple declaration
> of a variable is OK, as long as at most one has an initializer.

It should be easy enough to put that declaration on an architecture
you can build and check that way.

Multiple declaration of a variable with only one having an initializer
work because the variable gets put into the common section as I recall.
I don't believe this is portable to all C implementations. but the
important question is does this construct work in the kernel.

If it doesn't work as is we should be able to get similar behavior
from weak symbols.

Could you test that part of your patch please?

Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] move pm_power_off and pm_idle declaration to common code
  2005-12-12 14:28   ` Miklos Szeredi
  2005-12-12 14:36     ` Eric W. Biederman
@ 2005-12-12 14:39     ` Andreas Schwab
  2005-12-12 14:46       ` Miklos Szeredi
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2005-12-12 14:39 UTC (permalink / raw)
  To: Miklos Szeredi
  Cc: ebiederm, akpm, linux-kernel, pj, rth, davej, zwane, ak,
	ashok.raj

Miklos Szeredi <miklos@szeredi.hu> writes:

>> Does powerpc still build?  A key question is how do we handle architectures
>> that always want to want to call machine_power_off.
>
> I didn't (and can't) check, but it should.  IIRC multiple declaration
> of a variable is OK, as long as at most one has an initializer.

And as long as you don't build with -fno-common.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] move pm_power_off and pm_idle declaration to common code
  2005-12-12 14:39     ` Andreas Schwab
@ 2005-12-12 14:46       ` Miklos Szeredi
  2005-12-12 14:54         ` Eric W. Biederman
  0 siblings, 1 reply; 9+ messages in thread
From: Miklos Szeredi @ 2005-12-12 14:46 UTC (permalink / raw)
  To: schwab; +Cc: ebiederm, akpm, linux-kernel, pj, rth, davej, zwane, ak,
	ashok.raj

> >> Does powerpc still build?  A key question is how do we handle architectures
> >> that always want to want to call machine_power_off.
> >
> > I didn't (and can't) check, but it should.  IIRC multiple declaration
> > of a variable is OK, as long as at most one has an initializer.
> 
> And as long as you don't build with -fno-common.

That seals the argument, since -fno-common is in linux/Makefile.

So the patch wants fixing on powerpc, but I don't feel up to the task.

Somebody with better knowledge of that arch?

Miklos

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] move pm_power_off and pm_idle declaration to common code
  2005-12-12 14:46       ` Miklos Szeredi
@ 2005-12-12 14:54         ` Eric W. Biederman
  0 siblings, 0 replies; 9+ messages in thread
From: Eric W. Biederman @ 2005-12-12 14:54 UTC (permalink / raw)
  To: Miklos Szeredi
  Cc: schwab, akpm, linux-kernel, pj, rth, davej, zwane, ak, ashok.raj

Miklos Szeredi <miklos@szeredi.hu> writes:

>> >> Does powerpc still build?  A key question is how do we handle architectures
>> >> that always want to want to call machine_power_off.
>> >
>> > I didn't (and can't) check, but it should.  IIRC multiple declaration
>> > of a variable is OK, as long as at most one has an initializer.
>> 
>> And as long as you don't build with -fno-common.
>
> That seals the argument, since -fno-common is in linux/Makefile.
>
> So the patch wants fixing on powerpc, but I don't feel up to the task.
>
> Somebody with better knowledge of that arch?

It isn't just powerpc, alpha at least wants this behavior as well.

So until someone comes up with something better I am going to recommend
we fix the arches one at a time so we can actually audit them and
see what needs doing.

Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] uml: fix pm_power_off link failure
  2005-12-12 14:02 [PATCH] move pm_power_off and pm_idle declaration to common code Miklos Szeredi
  2005-12-12 14:20 ` Eric W. Biederman
@ 2005-12-12 15:26 ` Miklos Szeredi
  1 sibling, 0 replies; 9+ messages in thread
From: Miklos Szeredi @ 2005-12-12 15:26 UTC (permalink / raw)
  To: akpm; +Cc: ebiederm, linux-kernel

Andrew,

please scrap my the previous pm_power_off fix, it didn't work out.
This just fixes UML:

  LD      .tmp_vmlinux1
kernel/built-in.o(.text+0x148e1): In function `sys_reboot':
kernel/sys.c:535: undefined reference to `pm_power_off'

On uml machine_halt() just calls machine_power_off() so it's safe to
leave pm_power_off as NULL.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
---

Index: linux/arch/um/kernel/reboot.c
===================================================================
--- linux.orig/arch/um/kernel/reboot.c	2005-10-28 02:02:08.000000000 +0200
+++ linux/arch/um/kernel/reboot.c	2005-12-12 16:10:16.000000000 +0100
@@ -12,6 +12,8 @@
 #include "mode.h"
 #include "choose-mode.h"
 
+void (*pm_power_off)(void);
+
 #ifdef CONFIG_SMP
 static void kill_idlers(int me)
 {


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] move pm_power_off and pm_idle declaration to common code
  2005-12-12 14:20 ` Eric W. Biederman
  2005-12-12 14:28   ` Miklos Szeredi
@ 2005-12-12 15:58   ` Paul Jackson
  1 sibling, 0 replies; 9+ messages in thread
From: Paul Jackson @ 2005-12-12 15:58 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: miklos, akpm, linux-kernel, rth, davej, zwane, ak, ashok.raj

> A key question is how do we handle architectures
> that always want to want to call machine_power_off.

One common way to handle a generic default with possible arch specific
overrides is with #ifdef symbols.  Surround the generic definition with
something like "#ifndef ARCH_HAS_PM_POWER_OFF", and let the arch's that
want something other than the default define that preprocessor symbol
as well.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-12 15:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-12 14:02 [PATCH] move pm_power_off and pm_idle declaration to common code Miklos Szeredi
2005-12-12 14:20 ` Eric W. Biederman
2005-12-12 14:28   ` Miklos Szeredi
2005-12-12 14:36     ` Eric W. Biederman
2005-12-12 14:39     ` Andreas Schwab
2005-12-12 14:46       ` Miklos Szeredi
2005-12-12 14:54         ` Eric W. Biederman
2005-12-12 15:58   ` Paul Jackson
2005-12-12 15:26 ` [PATCH] uml: fix pm_power_off link failure Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox