From: Alexey Dobriyan <adobriyan@gmail.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, rmk@arm.linux.org.uk
Subject: [PATCH] seq_file conversion: APM on arm
Date: Mon, 15 Jan 2007 23:59:35 +0300 [thread overview]
Message-ID: <20070115205935.GA5010@martell.zuzino.mipt.ru> (raw)
Compile-tested.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
arch/arm/kernel/apm.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
--- a/arch/arm/kernel/apm.c
+++ b/arch/arm/kernel/apm.c
@@ -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);
next reply other threads:[~2007-01-15 20:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-15 20:59 Alexey Dobriyan [this message]
2007-01-24 0:45 ` Andrew Morton
2007-01-24 1:52 ` Ralf Baechle
2007-01-24 7:13 ` Paul Mundt
2007-01-24 12:37 ` Ralf Baechle
2007-01-24 12:44 ` [PATCH 1/3] Add shared version of APM emulation Ralf Baechle
2007-01-24 12:45 ` [PATCH 2/3] ARM: Convert to use shared " Ralf Baechle
2007-01-24 17:50 ` Pavel Machek
2007-01-26 13:04 ` Ralf Baechle
2007-01-26 13:06 ` Ralf Baechle
2007-01-24 12:46 ` [PATCH 3/3] MIPS: " Ralf Baechle
2007-01-24 12:56 ` [PATCH] sh: " Paul Mundt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070115205935.GA5010@martell.zuzino.mipt.ru \
--to=adobriyan@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®