diff options
Diffstat (limited to 'drivers/isdn/hysdn/hycapi.c')
-rw-r--r-- | drivers/isdn/hysdn/hycapi.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index 4ffaa14b9fc4..fe874afa4f81 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -11,6 +11,8 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/proc_fs.h> | ||
15 | #include <linux/seq_file.h> | ||
14 | #include <linux/signal.h> | 16 | #include <linux/signal.h> |
15 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
16 | #include <linux/skbuff.h> | 18 | #include <linux/skbuff.h> |
@@ -432,26 +434,16 @@ static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) | |||
432 | return retval; | 434 | return retval; |
433 | } | 435 | } |
434 | 436 | ||
435 | /********************************************************************* | 437 | static int hycapi_proc_show(struct seq_file *m, void *v) |
436 | hycapi_read_proc | ||
437 | |||
438 | Informations provided in the /proc/capi-entries. | ||
439 | |||
440 | *********************************************************************/ | ||
441 | |||
442 | static int hycapi_read_proc(char *page, char **start, off_t off, | ||
443 | int count, int *eof, struct capi_ctr *ctrl) | ||
444 | { | 438 | { |
439 | struct capi_ctr *ctrl = m->private; | ||
445 | hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata); | 440 | hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata); |
446 | hysdn_card *card = cinfo->card; | 441 | hysdn_card *card = cinfo->card; |
447 | int len = 0; | ||
448 | char *s; | 442 | char *s; |
449 | #ifdef HYCAPI_PRINTFNAMES | 443 | |
450 | printk(KERN_NOTICE "hycapi_read_proc\n"); | 444 | seq_printf(m, "%-16s %s\n", "name", cinfo->cardname); |
451 | #endif | 445 | seq_printf(m, "%-16s 0x%x\n", "io", card->iobase); |
452 | len += sprintf(page+len, "%-16s %s\n", "name", cinfo->cardname); | 446 | seq_printf(m, "%-16s %d\n", "irq", card->irq); |
453 | len += sprintf(page+len, "%-16s 0x%x\n", "io", card->iobase); | ||
454 | len += sprintf(page+len, "%-16s %d\n", "irq", card->irq); | ||
455 | 447 | ||
456 | switch (card->brdtype) { | 448 | switch (card->brdtype) { |
457 | case BD_PCCARD: s = "HYSDN Hycard"; break; | 449 | case BD_PCCARD: s = "HYSDN Hycard"; break; |
@@ -461,24 +453,32 @@ static int hycapi_read_proc(char *page, char **start, off_t off, | |||
461 | case BD_PLEXUS: s = "HYSDN Plexus30"; break; | 453 | case BD_PLEXUS: s = "HYSDN Plexus30"; break; |
462 | default: s = "???"; break; | 454 | default: s = "???"; break; |
463 | } | 455 | } |
464 | len += sprintf(page+len, "%-16s %s\n", "type", s); | 456 | seq_printf(m, "%-16s %s\n", "type", s); |
465 | if ((s = cinfo->version[VER_DRIVER]) != NULL) | 457 | if ((s = cinfo->version[VER_DRIVER]) != NULL) |
466 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); | 458 | seq_printf(m, "%-16s %s\n", "ver_driver", s); |
467 | if ((s = cinfo->version[VER_CARDTYPE]) != NULL) | 459 | if ((s = cinfo->version[VER_CARDTYPE]) != NULL) |
468 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); | 460 | seq_printf(m, "%-16s %s\n", "ver_cardtype", s); |
469 | if ((s = cinfo->version[VER_SERIAL]) != NULL) | 461 | if ((s = cinfo->version[VER_SERIAL]) != NULL) |
470 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); | 462 | seq_printf(m, "%-16s %s\n", "ver_serial", s); |
471 | 463 | ||
472 | len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); | 464 | seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname); |
473 | 465 | ||
474 | if (off+count >= len) | 466 | return 0; |
475 | *eof = 1; | 467 | } |
476 | if (len < off) | 468 | |
477 | return 0; | 469 | static int hycapi_proc_open(struct inode *inode, struct file *file) |
478 | *start = page + off; | 470 | { |
479 | return ((count < len-off) ? count : len-off); | 471 | return single_open(file, hycapi_proc_show, PDE(inode)->data); |
480 | } | 472 | } |
481 | 473 | ||
474 | static const struct file_operations hycapi_proc_fops = { | ||
475 | .owner = THIS_MODULE, | ||
476 | .open = hycapi_proc_open, | ||
477 | .read = seq_read, | ||
478 | .llseek = seq_lseek, | ||
479 | .release = single_release, | ||
480 | }; | ||
481 | |||
482 | /************************************************************** | 482 | /************************************************************** |
483 | hycapi_load_firmware | 483 | hycapi_load_firmware |
484 | 484 | ||
@@ -774,7 +774,7 @@ hycapi_capi_create(hysdn_card *card) | |||
774 | ctrl->load_firmware = hycapi_load_firmware; | 774 | ctrl->load_firmware = hycapi_load_firmware; |
775 | ctrl->reset_ctr = hycapi_reset_ctr; | 775 | ctrl->reset_ctr = hycapi_reset_ctr; |
776 | ctrl->procinfo = hycapi_procinfo; | 776 | ctrl->procinfo = hycapi_procinfo; |
777 | ctrl->ctr_read_proc = hycapi_read_proc; | 777 | ctrl->proc_fops = &hycapi_proc_fops; |
778 | strcpy(ctrl->name, cinfo->cardname); | 778 | strcpy(ctrl->name, cinfo->cardname); |
779 | ctrl->owner = THIS_MODULE; | 779 | ctrl->owner = THIS_MODULE; |
780 | 780 | ||