From 6f28ae7a229548614f96dd8840f32e2e5ffaf680 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Sat, 10 Feb 2007 01:46:15 -0800 Subject: [PATCH] --- yaml --- r: 47599 b: refs/heads/master c: 967bb77c69e3bc44dd1128a8b503a205cce3fd4a h: refs/heads/master i: 47597: 0fe4c3c4a39ebe2e3eee5657c82e2841b2787df6 47595: 7b29e7a2943203169fe19bab9b354a0a713daa9a 47591: 174256aba7a8de23b05747539800664d2c7b45c7 47583: 09e5e632b9b27571f1de86663c623d99cdee9d2b v: v3 --- [refs] | 2 +- trunk/drivers/char/toshiba.c | 35 +++++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 7621857569ea..1dea973e2821 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2e7842b887627c4319c4625d2b52fa6616fda2cd +refs/heads/master: 967bb77c69e3bc44dd1128a8b503a205cce3fd4a diff --git a/trunk/drivers/char/toshiba.c b/trunk/drivers/char/toshiba.c index 07067c31c4ec..c346ec5a3dc9 100644 --- a/trunk/drivers/char/toshiba.c +++ b/trunk/drivers/char/toshiba.c @@ -68,6 +68,7 @@ #include #include #include +#include #include @@ -298,12 +299,10 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, * Print the information for /proc/toshiba */ #ifdef CONFIG_PROC_FS -static int tosh_get_info(char *buffer, char **start, off_t fpos, int length) +static int proc_toshiba_show(struct seq_file *m, void *v) { - char *temp; int key; - temp = buffer; key = tosh_fn_status(); /* Arguments @@ -314,8 +313,7 @@ static int tosh_get_info(char *buffer, char **start, off_t fpos, int length) 4) BIOS date (in SCI date format) 5) Fn Key status */ - - temp += sprintf(temp, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n", + seq_printf(m, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n", tosh_id, (tosh_sci & 0xff00)>>8, tosh_sci & 0xff, @@ -323,9 +321,21 @@ static int tosh_get_info(char *buffer, char **start, off_t fpos, int length) tosh_bios & 0xff, tosh_date, key); + return 0; +} - return temp-buffer; +static int proc_toshiba_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_toshiba_show, NULL); } + +static const struct file_operations proc_toshiba_fops = { + .owner = THIS_MODULE, + .open = proc_toshiba_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; #endif @@ -508,10 +518,15 @@ static int __init toshiba_init(void) return retval; #ifdef CONFIG_PROC_FS - /* register the proc entry */ - if (create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL) { - misc_deregister(&tosh_device); - return -ENOMEM; + { + struct proc_dir_entry *pde; + + pde = create_proc_entry("toshiba", 0, NULL); + if (!pde) { + misc_deregister(&tosh_device); + return -ENOMEM; + } + pde->proc_fops = &proc_toshiba_fops; } #endif