/*
- * linux/arch/parisc/kernel/power.c
+ * linux/drivers/parisc/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.
*
*
* runtime through the "/proc/sys/kernel/power" procfs entry.
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#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
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();
}
static void poweroff(void)
{
- static int powering_off;
+ static int powering_off __read_mostly;
if (powering_off)
return;
/* 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();
}
}
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)
*/
static void gecko_tasklet_func(unsigned long unused)
{
- if (!pwrsw_enabled)
+ if (unlikely(!pwrsw_enabled))
return;
if (__getDIAG(25) & 0x80000000) {
{
unsigned long current_status;
- if (!pwrsw_enabled)
+ if (unlikely(!pwrsw_enabled))
return;
current_status = gsc_readl(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();
}
/* 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);
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);
}