X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fparisc%2Fpower.c;h=0bcab83b40804f751d173d4d2ee205ca715906f6;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=9a2a26c22019cf44e0b175889e42e15ef7216f30;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c index 9a2a26c22..0bcab83b4 100644 --- a/drivers/parisc/power.c +++ b/drivers/parisc/power.c @@ -2,7 +2,7 @@ * linux/arch/parisc/kernel/power.c * HP PARISC soft power switch support driver * - * Copyright (c) 2001-2002 Helge Deller + * Copyright (c) 2001-2005 Helge Deller * All rights reserved. * * @@ -47,16 +47,15 @@ #include #include -#include #include #include #include #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); }