diff options
author | Alexey Dobriyan <adobriyan@sw.ru> | 2008-04-10 20:34:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:40 -0400 |
commit | 0b9c2b7a413c0e79254f17bbe095cee24885cd4b (patch) | |
tree | 6cbd3b11e54aec4f50296a9f107189a4811b47c3 /drivers/media/radio/radio-typhoon.c | |
parent | 9faa2d75822e1950b3aacc8ccbdf0cdb595e47de (diff) |
V4L/DVB (7582): proc: switch /proc/driver/radio-typhoon to seq_file interface
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/radio/radio-typhoon.c')
-rw-r--r-- | drivers/media/radio/radio-typhoon.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index 8b9888337bd1..18f2abd7e255 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/init.h> /* Initdata */ | 35 | #include <linux/init.h> /* Initdata */ |
36 | #include <linux/ioport.h> /* request_region */ | 36 | #include <linux/ioport.h> /* request_region */ |
37 | #include <linux/proc_fs.h> /* radio card status report */ | 37 | #include <linux/proc_fs.h> /* radio card status report */ |
38 | #include <linux/seq_file.h> | ||
38 | #include <asm/io.h> /* outb, outb_p */ | 39 | #include <asm/io.h> /* outb, outb_p */ |
39 | #include <asm/uaccess.h> /* copy to/from user */ | 40 | #include <asm/uaccess.h> /* copy to/from user */ |
40 | #include <linux/videodev2.h> /* kernel radio structs */ | 41 | #include <linux/videodev2.h> /* kernel radio structs */ |
@@ -93,9 +94,6 @@ static int typhoon_setfreq(struct typhoon_device *dev, unsigned long frequency); | |||
93 | static void typhoon_mute(struct typhoon_device *dev); | 94 | static void typhoon_mute(struct typhoon_device *dev); |
94 | static void typhoon_unmute(struct typhoon_device *dev); | 95 | static void typhoon_unmute(struct typhoon_device *dev); |
95 | static int typhoon_setvol(struct typhoon_device *dev, int vol); | 96 | static int typhoon_setvol(struct typhoon_device *dev, int vol); |
96 | #ifdef CONFIG_RADIO_TYPHOON_PROC_FS | ||
97 | static int typhoon_get_info(char *buf, char **start, off_t offset, int len); | ||
98 | #endif | ||
99 | 97 | ||
100 | static void typhoon_setvol_generic(struct typhoon_device *dev, int vol) | 98 | static void typhoon_setvol_generic(struct typhoon_device *dev, int vol) |
101 | { | 99 | { |
@@ -368,30 +366,39 @@ static struct video_device typhoon_radio = | |||
368 | 366 | ||
369 | #ifdef CONFIG_RADIO_TYPHOON_PROC_FS | 367 | #ifdef CONFIG_RADIO_TYPHOON_PROC_FS |
370 | 368 | ||
371 | static int typhoon_get_info(char *buf, char **start, off_t offset, int len) | 369 | static int typhoon_proc_show(struct seq_file *m, void *v) |
372 | { | 370 | { |
373 | char *out = buf; | ||
374 | |||
375 | #ifdef MODULE | 371 | #ifdef MODULE |
376 | #define MODULEPROCSTRING "Driver loaded as a module" | 372 | #define MODULEPROCSTRING "Driver loaded as a module" |
377 | #else | 373 | #else |
378 | #define MODULEPROCSTRING "Driver compiled into kernel" | 374 | #define MODULEPROCSTRING "Driver compiled into kernel" |
379 | #endif | 375 | #endif |
380 | 376 | ||
381 | /* output must be kept under PAGE_SIZE */ | 377 | seq_puts(m, BANNER); |
382 | out += sprintf(out, BANNER); | 378 | seq_puts(m, "Load type: " MODULEPROCSTRING "\n\n"); |
383 | out += sprintf(out, "Load type: " MODULEPROCSTRING "\n\n"); | 379 | seq_printf(m, "frequency = %lu kHz\n", |
384 | out += sprintf(out, "frequency = %lu kHz\n", | ||
385 | typhoon_unit.curfreq >> 4); | 380 | typhoon_unit.curfreq >> 4); |
386 | out += sprintf(out, "volume = %d\n", typhoon_unit.curvol); | 381 | seq_printf(m, "volume = %d\n", typhoon_unit.curvol); |
387 | out += sprintf(out, "mute = %s\n", typhoon_unit.muted ? | 382 | seq_printf(m, "mute = %s\n", typhoon_unit.muted ? |
388 | "on" : "off"); | 383 | "on" : "off"); |
389 | out += sprintf(out, "iobase = 0x%x\n", typhoon_unit.iobase); | 384 | seq_printf(m, "iobase = 0x%x\n", typhoon_unit.iobase); |
390 | out += sprintf(out, "mute frequency = %lu kHz\n", | 385 | seq_printf(m, "mute frequency = %lu kHz\n", |
391 | typhoon_unit.mutefreq >> 4); | 386 | typhoon_unit.mutefreq >> 4); |
392 | return out - buf; | 387 | return 0; |
393 | } | 388 | } |
394 | 389 | ||
390 | static int typhoon_proc_open(struct inode *inode, struct file *file) | ||
391 | { | ||
392 | return single_open(file, typhoon_proc_show, NULL); | ||
393 | } | ||
394 | |||
395 | static const struct file_operations typhoon_proc_fops = { | ||
396 | .owner = THIS_MODULE, | ||
397 | .open = typhoon_proc_open, | ||
398 | .read = seq_read, | ||
399 | .llseek = seq_lseek, | ||
400 | .release = single_release, | ||
401 | }; | ||
395 | #endif /* CONFIG_RADIO_TYPHOON_PROC_FS */ | 402 | #endif /* CONFIG_RADIO_TYPHOON_PROC_FS */ |
396 | 403 | ||
397 | MODULE_AUTHOR("Dr. Henrik Seidel"); | 404 | MODULE_AUTHOR("Dr. Henrik Seidel"); |
@@ -452,8 +459,7 @@ static int __init typhoon_init(void) | |||
452 | typhoon_mute(&typhoon_unit); | 459 | typhoon_mute(&typhoon_unit); |
453 | 460 | ||
454 | #ifdef CONFIG_RADIO_TYPHOON_PROC_FS | 461 | #ifdef CONFIG_RADIO_TYPHOON_PROC_FS |
455 | if (!create_proc_info_entry("driver/radio-typhoon", 0, NULL, | 462 | if (!proc_create("driver/radio-typhoon", 0, NULL, &typhoon_proc_fops)) |
456 | typhoon_get_info)) | ||
457 | printk(KERN_ERR "radio-typhoon: registering /proc/driver/radio-typhoon failed\n"); | 463 | printk(KERN_ERR "radio-typhoon: registering /proc/driver/radio-typhoon failed\n"); |
458 | #endif | 464 | #endif |
459 | 465 | ||