X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fparisc%2Fpower.c;h=97e9dc066f95fc278cbc34bc1e49753bbf2f431d;hb=refs%2Fheads%2Fvserver;hp=d097e7ecdf8eaaf2ffec4f323d0ce7888f543b0d;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c index d097e7ecd..97e9dc066 100644 --- a/drivers/parisc/power.c +++ b/drivers/parisc/power.c @@ -1,8 +1,8 @@ /* - * linux/arch/parisc/kernel/power.c + * linux/drivers/parisc/power.c * HP PARISC soft power switch support driver * - * Copyright (c) 2001-2002 Helge Deller + * Copyright (c) 2001-2005 Helge Deller * All rights reserved. * * @@ -35,7 +35,6 @@ * runtime through the "/proc/sys/kernel/power" procfs entry. */ -#include #include #include #include @@ -47,7 +46,6 @@ #include #include -#include #include #include #include @@ -86,8 +84,7 @@ static void deferred_poweroff(void *dummy) { - extern int cad_pid; /* from kernel/sys.c */ - if (kill_proc(cad_pid, SIGINT, 1)) { + if (kill_cad_pid(SIGINT, 1)) { /* just in case killing init process failed */ machine_power_off(); } @@ -103,7 +100,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,7 +111,7 @@ 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) @@ -126,11 +123,11 @@ static void process_shutdown(void) /* 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..."; +#endif DPRINTK(KERN_INFO "%s\n", msg); -#ifdef CONFIG_CHASSIS_LCD_LED lcd_print(msg); -#endif poweroff(); } } @@ -140,7 +137,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 +147,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 +171,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); @@ -191,7 +188,7 @@ static void polling_tasklet_func(unsigned long soft_power_reg) * powerfail interruption handler (irq IRQ_FROM_REGION(CPU_IRQ_REGION)+2) */ #if 0 -static void powerfail_interrupt(int code, void *x, struct pt_regs *regs) +static void powerfail_interrupt(int code, void *x) { printk(KERN_CRIT "POWERFAIL INTERRUPTION !\n"); poweroff(); @@ -252,7 +249,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 +263,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); }