From: Paul M. <le...@us...> - 2006-01-30 15:57:31
|
Update of /cvsroot/linuxsh/linux/arch/sh/boards/hp6xx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14611/arch/sh/boards/hp6xx Modified Files: hp6xx_apm.c pm.c pm_wakeup.S Log Message: Cheaper locking and some Lindent cleanup. Index: hp6xx_apm.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/boards/hp6xx/hp6xx_apm.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- hp6xx_apm.c 29 Jan 2006 17:46:23 -0000 1.1 +++ hp6xx_apm.c 30 Jan 2006 15:57:17 -0000 1.2 @@ -1,19 +1,13 @@ /* - * bios-less APM driver for hp680 + * bios-less APM driver for hp680 * * Copyright 2005 (c) Andriy Skulysh <ask...@gm...> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License. - * */ - #include <linux/config.h> #include <linux/module.h> -#include <linux/poll.h> -#include <linux/timer.h> -#include <linux/slab.h> -#include <linux/sched.h> #include <linux/apm_bios.h> #include <linux/kernel.h> #include <linux/init.h> @@ -46,9 +40,13 @@ int battery = adc_single(ADC_CHANNEL_BATTERY); int backup = adc_single(ADC_CHANNEL_BACKUP); int charging = adc_single(ADC_CHANNEL_CHARGE); - int percentage = 100*(battery-HP680_BATTERY_MIN)/(HP680_BATTERY_MAX-HP680_BATTERY_MIN); + int percentage; - ac_line_status = (battery > HP680_BATTERY_AC_ON) ? APM_AC_ONLINE : APM_AC_OFFLINE; + percentage = 100 * (battery - HP680_BATTERY_MIN) / + (HP680_BATTERY_MAX - HP680_BATTERY_MIN); + + ac_line_status = (battery > HP680_BATTERY_AC_ON) ? + APM_AC_ONLINE : APM_AC_OFFLINE; p = buf; @@ -71,6 +69,7 @@ battery_status = APM_BATTERY_STATUS_HIGH; battery_flag = 0x01; } + p += sprintf(p, "1.0 1.2 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n", APM_32_BIT_SUPPORT, ac_line_status, @@ -79,17 +78,17 @@ percentage, time_units, "min"); - p += sprintf(p, "bat=%d backup=%d charge=%d\n", battery, backup, charging); + p += sprintf(p, "bat=%d backup=%d charge=%d\n", + battery, backup, charging); - return p-buf; + return p - buf; } static irqreturn_t hp6x0_apm_interrupt(int irq, void *dev, struct pt_regs *regs) { - if (!apm_suspended) { + if (!apm_suspended) apm_queue_event(APM_USER_SUSPEND); - } - + return IRQ_HANDLED; } @@ -97,9 +96,11 @@ { int ret; - ret = request_irq(HP680_BTN_IRQ, hp6x0_apm_interrupt, SA_INTERRUPT, MODNAME, 0); - if (ret < 0) { - printk(KERN_ERR MODNAME ": IRQ %d request failed\n", HP680_BTN_IRQ); + ret = request_irq(HP680_BTN_IRQ, hp6x0_apm_interrupt, + SA_INTERRUPT, MODNAME, 0); + if (unlikely(ret < 0)) { + printk(KERN_ERR MODNAME ": IRQ %d request failed\n", + HP680_BTN_IRQ); return ret; } @@ -120,4 +121,3 @@ MODULE_AUTHOR("Adriy Skulysh"); MODULE_DESCRIPTION("hp6xx Advanced Power Management"); MODULE_LICENSE("GPL"); - Index: pm.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/boards/hp6xx/pm.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pm.c 29 Jan 2006 17:46:23 -0000 1.1 +++ pm.c 30 Jan 2006 15:57:17 -0000 1.2 @@ -5,9 +5,7 @@ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License. - * */ - #include <linux/config.h> #include <linux/init.h> #include <linux/suspend.h> @@ -24,18 +22,18 @@ static int hp6x0_pm_enter(suspend_state_t state) { + u8 stbcr, stbcr2; #ifdef CONFIG_HD64461_ENABLER - u8 scr; + u8 scr; u16 hd64461_stbcr; #endif - u8 stbcr, stbcr2; - + if (state != PM_SUSPEND_MEM) return -EINVAL; #ifdef CONFIG_HD64461_ENABLER outb(0, HD64461_PCC1CSCIER); - + scr = inb(HD64461_PCC1SCR); scr |= HD64461_PCCSCR_VCC1; outb(scr, HD64461_PCC1SCR); @@ -52,7 +50,7 @@ stbcr2 = ctrl_inb(STBCR2); ctrl_outb(0x7f , STBCR2); - + outw(0xf07f, HD64461_SCPUCR); pm_enter(); Index: pm_wakeup.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/boards/hp6xx/pm_wakeup.S,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pm_wakeup.S 29 Jan 2006 17:46:23 -0000 1.1 +++ pm_wakeup.S 30 Jan 2006 15:57:17 -0000 1.2 @@ -16,11 +16,6 @@ #define k3 r3 #define k4 r4 -#define k_ex_code r2_bank /* r2_bank1 */ -#define g_imask r6 /* r6_bank1 */ -#define k_g_imask r6_bank /* r6_bank1 */ -#define current r7 /* r7_bank1 */ - /* * Kernel mode register usage: * k0 scratch |