Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / parisc / power.c
index 9a2a26c..0bcab83 100644 (file)
@@ -2,7 +2,7 @@
  * linux/arch/parisc/kernel/power.c
  * HP PARISC soft power switch support driver
  *
- * Copyright (c) 2001-2002 Helge Deller <deller@gmx.de>
+ * Copyright (c) 2001-2005 Helge Deller <deller@gmx.de>
  * All rights reserved.
  *
  *
 #include <linux/workqueue.h>
 
 #include <asm/pdc.h>
-#include <asm/irq.h>
 #include <asm/io.h>
 #include <asm/led.h>
 #include <asm/uaccess.h>
 
 
 #ifdef DEBUG
-# define DPRINTK(x) printk x
+# define DPRINTK(x...) printk(x)
 #else
-# define DPRINTK(x) do { } while (0)
+# define DPRINTK(x...)
 #endif
 
 
@@ -103,7 +102,7 @@ static DECLARE_WORK(poweroff_work, deferred_poweroff, NULL);
 
 static void poweroff(void)
 {
-       static int powering_off;
+       static int powering_off __read_mostly;
 
        if (powering_off)
                return;
@@ -114,23 +113,23 @@ static void poweroff(void)
 
 
 /* local time-counter for shutdown */
-static int shutdown_timer;
+static int shutdown_timer __read_mostly;
 
 /* check, give feedback and start shutdown after one second */
 static void process_shutdown(void)
 {
        if (shutdown_timer == 0)
-               DPRINTK((KERN_INFO "Shutdown requested...\n"));
+               DPRINTK(KERN_INFO "Shutdown requested...\n");
 
        shutdown_timer++;
        
        /* wait until the button was pressed for 1 second */
        if (shutdown_timer == HZ) {
+#if defined (DEBUG) || defined(CONFIG_CHASSIS_LCD_LED)
                static char msg[] = "Shutting down...";
-               DPRINTK((KERN_INFO "%s\n", msg));
-#ifdef CONFIG_CHASSIS_LCD_LED
-               lcd_print(msg);
 #endif
+               DPRINTK(KERN_INFO "%s\n", msg);
+               lcd_print(msg);
                poweroff();
        }
 }
@@ -140,7 +139,7 @@ static void process_shutdown(void)
 DECLARE_TASKLET_DISABLED(power_tasklet, NULL, 0);
 
 /* soft power switch enabled/disabled */
-int pwrsw_enabled = 1;
+int pwrsw_enabled __read_mostly = 1;
 
 /*
  * On gecko style machines (e.g. 712/xx and 715/xx) 
@@ -150,7 +149,7 @@ int pwrsw_enabled = 1;
  */
 static void gecko_tasklet_func(unsigned long unused)
 {
-       if (!pwrsw_enabled)
+       if (unlikely(!pwrsw_enabled))
                return;
 
        if (__getDIAG(25) & 0x80000000) {
@@ -174,7 +173,7 @@ static void polling_tasklet_func(unsigned long soft_power_reg)
 {
         unsigned long current_status;
        
-       if (!pwrsw_enabled)
+       if (unlikely(!pwrsw_enabled))
                return;
 
        current_status = gsc_readl(soft_power_reg);
@@ -252,7 +251,8 @@ static int __init power_init(void)
        }
 
        /* Register a call for panic conditions. */
-       notifier_chain_register(&panic_notifier_list, &parisc_panic_block);
+       atomic_notifier_chain_register(&panic_notifier_list,
+                       &parisc_panic_block);
 
        tasklet_enable(&power_tasklet);
 
@@ -265,7 +265,8 @@ static void __exit power_exit(void)
                return;
 
        tasklet_disable(&power_tasklet);
-       notifier_chain_unregister(&panic_notifier_list, &parisc_panic_block);
+       atomic_notifier_chain_unregister(&panic_notifier_list,
+                       &parisc_panic_block);
        power_tasklet.func = NULL;
        pdc_soft_power_button(0);
 }