aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/toshiba.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/toshiba.c')
-rw-r--r--drivers/char/toshiba.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 07067c31c4ec..c346ec5a3dc9 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -68,6 +68,7 @@
68#include <linux/init.h> 68#include <linux/init.h>
69#include <linux/stat.h> 69#include <linux/stat.h>
70#include <linux/proc_fs.h> 70#include <linux/proc_fs.h>
71#include <linux/seq_file.h>
71 72
72#include <linux/toshiba.h> 73#include <linux/toshiba.h>
73 74
@@ -298,12 +299,10 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
298 * Print the information for /proc/toshiba 299 * Print the information for /proc/toshiba
299 */ 300 */
300#ifdef CONFIG_PROC_FS 301#ifdef CONFIG_PROC_FS
301static int tosh_get_info(char *buffer, char **start, off_t fpos, int length) 302static int proc_toshiba_show(struct seq_file *m, void *v)
302{ 303{
303 char *temp;
304 int key; 304 int key;
305 305
306 temp = buffer;
307 key = tosh_fn_status(); 306 key = tosh_fn_status();
308 307
309 /* Arguments 308 /* Arguments
@@ -314,8 +313,7 @@ static int tosh_get_info(char *buffer, char **start, off_t fpos, int length)
314 4) BIOS date (in SCI date format) 313 4) BIOS date (in SCI date format)
315 5) Fn Key status 314 5) Fn Key status
316 */ 315 */
317 316 seq_printf(m, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n",
318 temp += sprintf(temp, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n",
319 tosh_id, 317 tosh_id,
320 (tosh_sci & 0xff00)>>8, 318 (tosh_sci & 0xff00)>>8,
321 tosh_sci & 0xff, 319 tosh_sci & 0xff,
@@ -323,9 +321,21 @@ static int tosh_get_info(char *buffer, char **start, off_t fpos, int length)
323 tosh_bios & 0xff, 321 tosh_bios & 0xff,
324 tosh_date, 322 tosh_date,
325 key); 323 key);
324 return 0;
325}
326 326
327 return temp-buffer; 327static int proc_toshiba_open(struct inode *inode, struct file *file)
328{
329 return single_open(file, proc_toshiba_show, NULL);
328} 330}
331
332static const struct file_operations proc_toshiba_fops = {
333 .owner = THIS_MODULE,
334 .open = proc_toshiba_open,
335 .read = seq_read,
336 .llseek = seq_lseek,
337 .release = single_release,
338};
329#endif 339#endif
330 340
331 341
@@ -508,10 +518,15 @@ static int __init toshiba_init(void)
508 return retval; 518 return retval;
509 519
510#ifdef CONFIG_PROC_FS 520#ifdef CONFIG_PROC_FS
511 /* register the proc entry */ 521 {
512 if (create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL) { 522 struct proc_dir_entry *pde;
513 misc_deregister(&tosh_device); 523
514 return -ENOMEM; 524 pde = create_proc_entry("toshiba", 0, NULL);
525 if (!pde) {
526 misc_deregister(&tosh_device);
527 return -ENOMEM;
528 }
529 pde->proc_fops = &proc_toshiba_fops;
515 } 530 }
516#endif 531#endif
517 532