The patch titled proc: switch /proc/apm to seq_file interface has been added to the -mm tree. Its filename is proc-switch-proc-apm-to-seq_file-interface.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: proc: switch /proc/apm to seq_file interface From: Alexey Dobriyan <adobriyan@xxxxx> Signed-off-by: Alexey Dobriyan <adobriyan@xxxxx> Cc: Rafael J. Wysocki <rjw@xxxxxxx> Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx> Cc: Len Brown <len.brown@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/char/apm-emulation.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff -puN drivers/char/apm-emulation.c~proc-switch-proc-apm-to-seq_file-interface drivers/char/apm-emulation.c --- a/drivers/char/apm-emulation.c~proc-switch-proc-apm-to-seq_file-interface +++ a/drivers/char/apm-emulation.c @@ -14,6 +14,7 @@ #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> @@ -493,11 +494,10 @@ static struct miscdevice apm_device = { * -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; @@ -515,14 +515,27 @@ 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 ret; + return 0; } + +static int proc_apm_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_apm_show, NULL); +} + +static const struct file_operations apm_proc_fops = { + .owner = THIS_MODULE, + .open = proc_apm_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; #endif static int kapmd(void *arg) @@ -593,7 +606,7 @@ 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); + proc_create("apm", 0, NULL, &apm_proc_fops); #endif ret = misc_register(&apm_device); _ Patches currently in -mm which might be from adobriyan@xxxxx are git-x86.patch git-net.patch git-cryptodev.patch keys-switch-to-proc_create.patch proc-print-more-information-when-removing-non-empty-directories.patch proc-switch-to-proc_create.patch proc-switch-proc-driver-ray_cs-ray_cs-to-seq_file-interface.patch proc-switch-proc-driver-radio-typhoon-to-seq_file-interface.patch proc-switch-proc-bus-zorro-devices-to-seq_file-interface.patch proc-switch-proc-apm-to-seq_file-interface.patch proc-remove-proc-mac_iop.patch proc-switch-proc-bus-ecard-devices-to-seq_file-interface.patch proc-switch-proc-excite-unit_id-to-seq_file-interface.patch proc-switch-proc-irda-irnet-to-seq_file-interface.patch proc-convert-proc-bus-nubus-to-seq_file-interface.patch proc-switch-proc-ip2mem-to-seq_file-interface.patch proc-switch-proc-scsi-device_info-to-seq_file-interface.patch proc-remove-get_info-infrastructure.patch sysctl-merge-equal-proc_sys_read-and-proc_sys_write.patch sysctl-clean-from-unneeded-extern-and-forward-declarations.patch sysctl-add-the-permissions-callback-on-the-ctl_table_root.patch single_open-seq_release-leak-diagnostics.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html