seq_file conversion: APM on arm
Subsystems (9)
PATCH 1/1 seq_file conversion: APM on arm
Compile-tested.
---
arch/arm/kernel/apm.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
arch/arm/kernel/apm.c +23 -5
@@ -14,6 +14,7 @@ #include <linux/module.h>#include <linux/poll.h> #include <linux/slab.h> #include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <linux/miscdevice.h> #include <linux/apm_bios.h> #include <linux/capability.h>
@@ -501,11 +502,10 @@ #ifdef CONFIG_PROC_FS* -1: Unknown * 8) min = minutes; sec = seconds */ -static int apm_get_info (char *buf,char **start,off_t fpos,int length) +static int proc_apm_show (struct seq_file *m,void *v) {struct apm_power_info info;char *units; -int ret; info.ac_line_status =0xff ; info.battery_status =0xff ;
@@ -523,14 +523,26 @@ static int apm_get_info(char *buf, char case 1: units = "sec"; break; } - ret =sprintf (buf,"%s 1.2 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n" , +seq_printf (m,"%s 1.2 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n" , driver_version,APM_32_BIT_SUPPORT , info.ac_line_status, info.battery_status, info.battery_flag, info.battery_life, info.time, units); +return 0 ; +} -return ret; +static int proc_apm_open (struct inode *inode,struct file *file) +{ +return single_open (file, proc_apm_show,NULL ); } + +static const struct file_operations proc_apm_fops = { + .owner =THIS_MODULE , + .open = proc_apm_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +};#endif static int kapmd (void *arg)
@@ -602,7 +614,13 @@ static int __init apm_init(void)wake_up_process (kapmd_tsk);#ifdef CONFIG_PROC_FS -create_proc_info_entry ("apm" ,0 ,NULL , apm_get_info); + { +struct proc_dir_entry *pde; + + pde =create_proc_entry ("apm" ,0 ,NULL ); +if (pde) + pde->proc_fops = &proc_apm_fops; + }#endif ret =misc_register (&apm_device);
arch/arm/kernel/apm.c
Quoted 10 lines · On Mon, 15 Jan 2007 23:59:35 +0300 Alexey Dobriyan <[email protected]> wrote:
Compile-tested.
Signed-off-by Alexey Dobriyan <[email protected]>---
arch/arm/kernel/apm.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)arch/arm/kernel/apm.c +0
-0
There is an ongoing desultory effort from Ralf to unify the ARM and MIPS APM implementations. Independently converting them both to use seqfile
at this stage might muck that up. Ralf, talk to me?
Quoted 3 lines · Andrew Morton
There is an ongoing desultory effort from Ralf to unify the ARM and MIPS APM implementations. Independently converting them both to use seqfile
at this stage might muck that up. Ralf, talk to me?
I was planning to get back to this next week but since soembody noticed this patch was still pending, why not now ;-)
Ralf
Quoted 3 lines · Andrew Morton
There is an ongoing desultory effort from Ralf to unify the ARM and MIPS APM implementations. Independently converting them both to use seqfile
at this stage might muck that up. Ralf, talk to me?
What happened with this anyways? As soon as I got the conversion for SH ready it was silently dropped from -mm. Is there anything that this is still waiting on?
Quoted 8 lines · Paul Mundt
Quoted 3 lines · Andrew Morton
There is an ongoing desultory effort from Ralf to unify the ARM and MIPS APM implementations. Independently converting them both to use seqfile
at this stage might muck that up. Ralf, talk to me?What happened with this anyways? As soon as I got the conversion for SH ready it was silently dropped from -mm. Is there anything that this is still waiting on?
There was a midair collision between this patchset and a few other patches from rmk. Andrew applied rmk's patches and due to the conflict with my patchset, so dropped mine which I started respinning last night until I ran out of midnight oil.
Ralf
PATCH 1/3 Add shared version of APM emulation
In reply to Paul MundtCurrently ARM and MIPS both have nearly identical copies of the APM emulation code in their arch code. Add yet another copy of it to drivers char and make it selectable through SYS_SUPPORTS_APM_EMULATION.
drivers/char/Makefile | 2 drivers/char/apm-emulation.c | 672 ++++++++++++++++++++++++++++++++++++++++++ include/linux/apm-emulation.h | 62 +++ kernel/power/Kconfig | 26 + 4 files changed, 762 insertions(+)
drivers/char/Makefile +2 -0
@@ -59,6 +59,8 @@ obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o obj-$(CONFIG_PRINTER) += lp.o obj-$(CONFIG_TIPAR) += tipar.o +obj-$(CONFIG_APM_EMULATION) += apm-emulation.o + obj-$(CONFIG_DTLK) += dtlk.o obj-$(CONFIG_R3964) += n_r3964.o obj-$(CONFIG_APPLICOM) += applicom.o
drivers/char/apm-emulation.c new file +672 -0
672 lines not on this page · raw message
kernel/power/Kconfig +26 -0
@@ -131,3 +131,29 @@ config SUSPEND_SMP bool depends on HOTPLUG_CPU && X86 && PM default y + +config APM_EMULATION + tristate "Advanced Power Management Emulation" + depends on PM && SYS_SUPPORTS_APM_EMULATION + help + APM is a BIOS specification for saving power using several different + techniques. This is mostly useful for battery powered laptops with + APM compliant BIOSes. If you say Y here, the system time will be + reset after a RESUME operation, the /proc/apm device will provide + battery status information, and user-space programs will receive + notification of APM "events" (e.g. battery status change). + + In order to use APM, you will need supporting software. For location + and more information, read <file:Documentation/pm.txt> and the + Battery Powered Linux mini-HOWTO, available from + <http://www.tldp.org/docs.html#howto>. + + This driver does not spin down disk drives (see the hdparm(8) + manpage ("man 8 hdparm") for that), and it doesn't turn off + VESA-compliant "green" monitors. + + Generally, if you don't have a battery in your machine, there isn't + much point in using this driver and you should say N. If you get + random kernel OOPSes or reboots that don't seem to be related to + anything, try disabling/enabling this option (or disabling/enabling + APM in your BIOS).
include/linux/apm-emulation.h new file +62 -0
62 lines not on this page · raw message
PATCH 2/3 ARM: Convert to use shared APM emulation.
arch/arm/Kconfig | 29 ++---------------- arch/arm/common/sharpsl_pm.c | 2 - arch/arm/kernel/Makefile | 1 arch/arm/mach-pxa/corgi_pm.c | 2 - arch/arm/mach-pxa/sharpsl_pm.c | 2 - arch/arm/mach-pxa/spitz_pm.c | 2 - include/asm-arm/apm.h | 64 ----------------------------------------- 7 files changed, 8 insertions(+), 94 deletions(-)
arch/arm/Kconfig +4 -25
@@ -9,6 +9,7 @@ config ARM bool default y select RTC_LIB + select SYS_SUPPORTS_APM_EMULATION help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and
@@ -17,6 +18,9 @@ config ARM Europe. There is an ARM Linux project with a web page at <http://www.arm.linux.org.uk/>. +config SYS_SUPPORTS_APM_EMULATION + bool + config GENERIC_TIME bool default n
@@ -856,31 +860,6 @@ menu "Power management options" source "kernel/power/Kconfig" -config APM - tristate "Advanced Power Management Emulation" - ---help--- - APM is a BIOS specification for saving power using several different - techniques. This is mostly useful for battery powered laptops with - APM compliant BIOSes. If you say Y here, the system time will be - reset after a RESUME operation, the /proc/apm device will provide - battery status information, and user-space programs will receive - notification of APM "events" (e.g. battery status change). - - In order to use APM, you will need supporting software. For location - and more information, read <file:Documentation/pm.txt> and the - Battery Powered Linux mini-HOWTO, available from - <http://www.tldp.org/docs.html#howto>. - - This driver does not spin down disk drives (see the hdparm(8) - manpage ("man 8 hdparm") for that), and it doesn't turn off - VESA-compliant "green" monitors. - - Generally, if you don't have a battery in your machine, there isn't - much point in using this driver and you should say N. If you get - random kernel OOPSes or reboots that don't seem to be related to - anything, try disabling/enabling this option (or disabling/enabling - APM in your BIOS). - endmenu source "net/Kconfig"
arch/arm/common/sharpsl_pm.c +1 -1
@@ -27,7 +27,7 @@#include <asm/hardware.h> #include <asm/mach-types.h> #include <asm/irq.h> -#include <asm/apm.h> +#include <asm/apm-emulation.h> #include <asm/arch/pm.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/sharpsl.h>
arch/arm/kernel/Makefile +0 -1
@@ -10,7 +10,6 @@ obj-y := compat.o entry-armv.o entry-co process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \ time.o traps.o -obj-$(CONFIG_APM) += apm.o obj-$(CONFIG_ISA_DMA_API) += dma.o obj-$(CONFIG_ARCH_ACORN) += ecard.o obj-$(CONFIG_FIQ) += fiq.o
arch/arm/mach-pxa/corgi_pm.c +1 -1
@@ -16,7 +16,7 @@#include <linux/delay.h> #include <linux/interrupt.h> #include <linux/platform_device.h> -#include <asm/apm.h> +#include <asm/apm-emulation.h> #include <asm/irq.h> #include <asm/mach-types.h> #include <asm/hardware.h>
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
@@ -23,7 +23,7 @@#include <asm/hardware.h> #include <asm/mach-types.h> -#include <asm/apm.h> +#include <asm/apm-emulation.h> #include <asm/arch/pm.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/sharpsl.h>
arch/arm/mach-pxa/spitz_pm.c +1 -1
@@ -16,7 +16,7 @@#include <linux/delay.h> #include <linux/interrupt.h> #include <linux/platform_device.h> -#include <asm/apm.h> +#include <asm/apm-emulation.h> #include <asm/irq.h> #include <asm/mach-types.h> #include <asm/hardware.h>
include/asm-arm/apm.h deleted +0 -64
64 lines not on this page · raw message
Re: [PATCH 2/3] ARM: Convert to use shared APM emulation.
Hi!
Quoted 10 lines
Signed-off-by Ralf Baechle <[email protected]>arch/arm/Kconfig | 29 ++---------------- arch/arm/common/sharpsl_pm.c | 2 - arch/arm/kernel/Makefile | 1 arch/arm/mach-pxa/corgi_pm.c | 2 - arch/arm/mach-pxa/sharpsl_pm.c | 2 - arch/arm/mach-pxa/spitz_pm.c | 2 - include/asm-arm/apm.h | 64 ----------------------------------------- 7 files changed, 8 insertions(+), 94 deletions(-)
Maybe you should delete apm.c, too?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 2/3] ARM: Convert to use shared APM emulation.
Quoted 10 lines · Pavel Machek
Quoted 8 lines
arch/arm/Kconfig | 29 ++---------------- arch/arm/common/sharpsl_pm.c | 2 - arch/arm/kernel/Makefile | 1 arch/arm/mach-pxa/corgi_pm.c | 2 - arch/arm/mach-pxa/sharpsl_pm.c | 2 - arch/arm/mach-pxa/spitz_pm.c | 2 - include/asm-arm/apm.h | 64 ----------------------------------------- 7 files changed, 8 insertions(+), 94 deletions(-)Maybe you should delete
apm.c, too?
Indeed ... New patch in reply to this email.
Thanks,
Ralf
PATCH 2/3 ARM: Convert to use shared APM emulation.
arch/arm/Kconfig | 29 - arch/arm/common/sharpsl_pm.c | 2 arch/arm/kernel/Makefile | 1 arch/arm/kernel/apm.c | 672 ----------------------------------------- arch/arm/mach-pxa/corgi_pm.c | 2 arch/arm/mach-pxa/sharpsl_pm.c | 2 arch/arm/mach-pxa/spitz_pm.c | 2 include/asm-arm/apm.h | 64 --- 8 files changed, 8 insertions(+), 766 deletions(-)
arch/arm/Kconfig +4 -25
@@ -9,6 +9,7 @@ config ARM bool default y select RTC_LIB + select SYS_SUPPORTS_APM_EMULATION help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and
@@ -17,6 +18,9 @@ config ARM Europe. There is an ARM Linux project with a web page at <http://www.arm.linux.org.uk/>. +config SYS_SUPPORTS_APM_EMULATION + bool + config GENERIC_TIME bool default n
@@ -856,31 +860,6 @@ menu "Power management options" source "kernel/power/Kconfig" -config APM - tristate "Advanced Power Management Emulation" - ---help--- - APM is a BIOS specification for saving power using several different - techniques. This is mostly useful for battery powered laptops with - APM compliant BIOSes. If you say Y here, the system time will be - reset after a RESUME operation, the /proc/apm device will provide - battery status information, and user-space programs will receive - notification of APM "events" (e.g. battery status change). - - In order to use APM, you will need supporting software. For location - and more information, read <file:Documentation/pm.txt> and the - Battery Powered Linux mini-HOWTO, available from - <http://www.tldp.org/docs.html#howto>. - - This driver does not spin down disk drives (see the hdparm(8) - manpage ("man 8 hdparm") for that), and it doesn't turn off - VESA-compliant "green" monitors. - - Generally, if you don't have a battery in your machine, there isn't - much point in using this driver and you should say N. If you get - random kernel OOPSes or reboots that don't seem to be related to - anything, try disabling/enabling this option (or disabling/enabling - APM in your BIOS). - endmenu source "net/Kconfig"
arch/arm/common/sharpsl_pm.c +1 -1
@@ -27,7 +27,7 @@#include <asm/hardware.h> #include <asm/mach-types.h> #include <asm/irq.h> -#include <asm/apm.h> +#include <asm/apm-emulation.h> #include <asm/arch/pm.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/sharpsl.h>
arch/arm/kernel/Makefile +0 -1
@@ -10,7 +10,6 @@ obj-y := compat.o entry-armv.o entry-co process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \ time.o traps.o -obj-$(CONFIG_APM) += apm.o obj-$(CONFIG_ISA_DMA_API) += dma.o obj-$(CONFIG_ARCH_ACORN) += ecard.o obj-$(CONFIG_FIQ) += fiq.o
arch/arm/mach-pxa/corgi_pm.c +1 -1
@@ -16,7 +16,7 @@#include <linux/delay.h> #include <linux/interrupt.h> #include <linux/platform_device.h> -#include <asm/apm.h> +#include <asm/apm-emulation.h> #include <asm/irq.h> #include <asm/mach-types.h> #include <asm/hardware.h>
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
@@ -23,7 +23,7 @@#include <asm/hardware.h> #include <asm/mach-types.h> -#include <asm/apm.h> +#include <asm/apm-emulation.h> #include <asm/arch/pm.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/sharpsl.h>
arch/arm/mach-pxa/spitz_pm.c +1 -1
@@ -16,7 +16,7 @@#include <linux/delay.h> #include <linux/interrupt.h> #include <linux/platform_device.h> -#include <asm/apm.h> +#include <asm/apm-emulation.h> #include <asm/irq.h> #include <asm/mach-types.h> #include <asm/hardware.h>
include/asm-arm/apm.h deleted +0 -64
64 lines not on this page · raw message
arch/arm/kernel/apm.c deleted +0 -672
672 lines not on this page · raw message
PATCH 3/3 MIPS: Convert to use shared APM emulation.
In reply to Ralf BaechleAlso convert to use generic kernel/power/Kconfig to make the use of the shared APM emulation possible.
arch/mips/Kconfig | 38 -- arch/mips/kernel/Makefile | 2 arch/mips/kernel/apm.c | 604 ---------------------------------------------- include/asm-mips/apm.h | 64 ---- 4 files changed, 9 insertions(+), 699 deletions(-)
arch/mips/Kconfig +9 -29
@@ -945,6 +945,9 @@ config CPU_LITTLE_ENDIAN endchoice +config SYS_SUPPORTS_APM_EMULATION + bool + config SYS_SUPPORTS_BIG_ENDIAN bool
@@ -1012,6 +1015,7 @@ config SOC_AU1X00 bool select SYS_HAS_CPU_MIPS32_R1 select SYS_SUPPORTS_32BIT_KERNEL + select SYS_SUPPORTS_APM_EMULATION config PNX8550 bool
@@ -2042,35 +2046,11 @@ config SECCOMP If unsure, say Y. Only embedded should say N here. -config PM - bool "Power Management support (EXPERIMENTAL)" - depends on EXPERIMENTAL && SOC_AU1X00 - -config APM - tristate "Advanced Power Management Emulation" - depends on PM - ---help--- - APM is a BIOS specification for saving power using several different - techniques. This is mostly useful for battery powered systems with - APM compliant BIOSes. If you say Y here, the system time will be - reset after a RESUME operation, the /proc/apm device will provide - battery status information, and user-space programs will receive - notification of APM "events" (e.g. battery status change). - - In order to use APM, you will need supporting software. For location - and more information, read <file:Documentation/pm.txt> and the - Battery Powered Linux mini-HOWTO, available from - <http://www.tldp.org/docs.html#howto>. - - This driver does not spin down disk drives (see the hdparm(8) - manpage ("man 8 hdparm") for that), and it doesn't turn off - VESA-compliant "green" monitors. - - Generally, if you don't have a battery in your machine, there isn't - much point in using this driver and you should say N. If you get - random kernel OOPSes or reboots that don't seem to be related to - anything, try disabling/enabling this option (or disabling/enabling - APM in your BIOS). +endmenu + +menu "Power management options" + +source "kernel/power/Kconfig" endmenu
arch/mips/kernel/Makefile +0 -2
@@ -14,8 +14,6 @@ binfmt_irix-objs := irixelf.o irixinv.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_MODULES) += mips_ksyms.o module.o -obj-$(CONFIG_APM) += apm.o - obj-$(CONFIG_CPU_R3000) += r2300_fpu.o r2300_switch.o obj-$(CONFIG_CPU_TX39XX) += r2300_fpu.o r2300_switch.o obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
include/asm-mips/apm.h deleted +0 -64
64 lines not on this page · raw message
arch/mips/kernel/apm.c deleted +0 -604
604 lines not on this page · raw message
PATCH 1/1 sh: Convert to use shared APM emulation.
In reply to Ralf BaechleQuoted 6 lines · Ralf Baechle
Currently ARM and MIPS both have nearly identical copies of the APM emulation code in their arch code. Add yet another copy of it to drivers char and make it selectable through
SYS_SUPPORTS_APM_EMULATION.Signed-off-by Ralf Baechle <[email protected]>
Here's the updated SH version (the only change from the old version was that SYS_SUPPORTS_APM_EMULATION is added to the arch Kconfig).
--
arch/sh/Kconfig | 7 arch/sh/boards/hp6xx/hp6xx_apm.c | 68 +--- arch/sh/kernel/Makefile | 1 arch/sh/kernel/apm.c | 538 --------------------------------------- include/asm-sh/apm.h | 46 --- 5 files changed, 28 insertions(+), 632 deletions(-)
arch/sh/Kconfig +4 -3
@@ -48,6 +48,9 @@ config GENERIC_IOMAP config GENERIC_TIME def_bool n +config SYS_SUPPORTS_APM_EMULATION + bool + config ARCH_MAY_HAVE_PC_FDC bool
@@ -126,6 +129,7 @@ config SH_7751_SYSTEMH config SH_HP6XX bool "HP6XX" + select SYS_SUPPORTS_APM_EMULATION help Select HP6XX if configuring for a HP jornada HP6xx. More information (hardware only) at
@@ -694,9 +698,6 @@ depends on EXPERIMENTAL source kernel/power/Kconfig -config APM - bool "Advanced Power Management Emulation" - depends on PM endmenu source "net/Kconfig"
arch/sh/boards/hp6xx/hp6xx_apm.c +24 -44
117 lines not on this page · raw message
arch/sh/kernel/Makefile +0 -1
@@ -19,6 +19,5 @@ obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o -obj-$(CONFIG_APM) += apm.o obj-$(CONFIG_PM) += pm.o obj-$(CONFIG_STACKTRACE) += stacktrace.o
arch/sh/kernel/apm.c deleted +0 -538
538 lines not on this page · raw message
include/asm-sh/apm.h deleted +0 -46
46 lines not on this page · raw message