aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/avm
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2010-01-14 06:10:54 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-14 06:10:54 -0500
commit9a58a80a701bdb2d220cdab4914218df5b48d781 (patch)
tree01eeb65ec70f22ec326d0938d002cc6a2aec73e8 /drivers/isdn/hardware/avm
parent508e14b4a4fb1a824a14f2c5b8d7df67b313f8e4 (diff)
proc_fops: convert drivers/isdn/ to seq_file
Convert code away from ->read_proc/->write_proc interfaces. Switch to proc_create()/proc_create_data() which make addition of proc entries reliable wrt NULL ->proc_fops, NULL ->data and so on. Problem with ->read_proc et al is described here commit 786d7e1612f0b0adb6046f19b906609e4fe8b1ba "Fix rmmod/read/write races in /proc entries" [akpm@linux-foundation.org: CONFIG_PROC_FS=n build fix] Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: Karsten Keil <keil@b1-systems.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/hardware/avm')
-rw-r--r--drivers/isdn/hardware/avm/avmcard.h6
-rw-r--r--drivers/isdn/hardware/avm/b1.c54
-rw-r--r--drivers/isdn/hardware/avm/b1dma.c71
-rw-r--r--drivers/isdn/hardware/avm/b1isa.c2
-rw-r--r--drivers/isdn/hardware/avm/b1pci.c4
-rw-r--r--drivers/isdn/hardware/avm/b1pcmcia.c2
-rw-r--r--drivers/isdn/hardware/avm/c4.c53
-rw-r--r--drivers/isdn/hardware/avm/t1isa.c2
-rw-r--r--drivers/isdn/hardware/avm/t1pci.c2
9 files changed, 107 insertions, 89 deletions
diff --git a/drivers/isdn/hardware/avm/avmcard.h b/drivers/isdn/hardware/avm/avmcard.h
index d964f07e4a56..a70e8854461d 100644
--- a/drivers/isdn/hardware/avm/avmcard.h
+++ b/drivers/isdn/hardware/avm/avmcard.h
@@ -556,8 +556,7 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
556void b1_parse_version(avmctrl_info *card); 556void b1_parse_version(avmctrl_info *card);
557irqreturn_t b1_interrupt(int interrupt, void *devptr); 557irqreturn_t b1_interrupt(int interrupt, void *devptr);
558 558
559int b1ctl_read_proc(char *page, char **start, off_t off, 559extern const struct file_operations b1ctl_proc_fops;
560 int count, int *eof, struct capi_ctr *ctrl);
561 560
562avmcard_dmainfo *avmcard_dma_alloc(char *name, struct pci_dev *, 561avmcard_dmainfo *avmcard_dma_alloc(char *name, struct pci_dev *,
563 long rsize, long ssize); 562 long rsize, long ssize);
@@ -577,7 +576,6 @@ void b1dma_register_appl(struct capi_ctr *ctrl,
577 capi_register_params *rp); 576 capi_register_params *rp);
578void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl); 577void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl);
579u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb); 578u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
580int b1dmactl_read_proc(char *page, char **start, off_t off, 579extern const struct file_operations b1dmactl_proc_fops;
581 int count, int *eof, struct capi_ctr *ctrl);
582 580
583#endif /* _AVMCARD_H_ */ 581#endif /* _AVMCARD_H_ */
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
index a7c0083e78a7..c38fa0f4c729 100644
--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -12,6 +12,8 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/proc_fs.h>
16#include <linux/seq_file.h>
15#include <linux/skbuff.h> 17#include <linux/skbuff.h>
16#include <linux/delay.h> 18#include <linux/delay.h>
17#include <linux/mm.h> 19#include <linux/mm.h>
@@ -634,18 +636,17 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
634} 636}
635 637
636/* ------------------------------------------------------------- */ 638/* ------------------------------------------------------------- */
637int b1ctl_read_proc(char *page, char **start, off_t off, 639static int b1ctl_proc_show(struct seq_file *m, void *v)
638 int count, int *eof, struct capi_ctr *ctrl)
639{ 640{
641 struct capi_ctr *ctrl = m->private;
640 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); 642 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
641 avmcard *card = cinfo->card; 643 avmcard *card = cinfo->card;
642 u8 flag; 644 u8 flag;
643 int len = 0;
644 char *s; 645 char *s;
645 646
646 len += sprintf(page+len, "%-16s %s\n", "name", card->name); 647 seq_printf(m, "%-16s %s\n", "name", card->name);
647 len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port); 648 seq_printf(m, "%-16s 0x%x\n", "io", card->port);
648 len += sprintf(page+len, "%-16s %d\n", "irq", card->irq); 649 seq_printf(m, "%-16s %d\n", "irq", card->irq);
649 switch (card->cardtype) { 650 switch (card->cardtype) {
650 case avm_b1isa: s = "B1 ISA"; break; 651 case avm_b1isa: s = "B1 ISA"; break;
651 case avm_b1pci: s = "B1 PCI"; break; 652 case avm_b1pci: s = "B1 PCI"; break;
@@ -658,20 +659,20 @@ int b1ctl_read_proc(char *page, char **start, off_t off,
658 case avm_c2: s = "C2"; break; 659 case avm_c2: s = "C2"; break;
659 default: s = "???"; break; 660 default: s = "???"; break;
660 } 661 }
661 len += sprintf(page+len, "%-16s %s\n", "type", s); 662 seq_printf(m, "%-16s %s\n", "type", s);
662 if (card->cardtype == avm_t1isa) 663 if (card->cardtype == avm_t1isa)
663 len += sprintf(page+len, "%-16s %d\n", "cardnr", card->cardnr); 664 seq_printf(m, "%-16s %d\n", "cardnr", card->cardnr);
664 if ((s = cinfo->version[VER_DRIVER]) != NULL) 665 if ((s = cinfo->version[VER_DRIVER]) != NULL)
665 len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); 666 seq_printf(m, "%-16s %s\n", "ver_driver", s);
666 if ((s = cinfo->version[VER_CARDTYPE]) != NULL) 667 if ((s = cinfo->version[VER_CARDTYPE]) != NULL)
667 len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); 668 seq_printf(m, "%-16s %s\n", "ver_cardtype", s);
668 if ((s = cinfo->version[VER_SERIAL]) != NULL) 669 if ((s = cinfo->version[VER_SERIAL]) != NULL)
669 len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); 670 seq_printf(m, "%-16s %s\n", "ver_serial", s);
670 671
671 if (card->cardtype != avm_m1) { 672 if (card->cardtype != avm_m1) {
672 flag = ((u8 *)(ctrl->profile.manu))[3]; 673 flag = ((u8 *)(ctrl->profile.manu))[3];
673 if (flag) 674 if (flag)
674 len += sprintf(page+len, "%-16s%s%s%s%s%s%s%s\n", 675 seq_printf(m, "%-16s%s%s%s%s%s%s%s\n",
675 "protocol", 676 "protocol",
676 (flag & 0x01) ? " DSS1" : "", 677 (flag & 0x01) ? " DSS1" : "",
677 (flag & 0x02) ? " CT1" : "", 678 (flag & 0x02) ? " CT1" : "",
@@ -685,7 +686,7 @@ int b1ctl_read_proc(char *page, char **start, off_t off,
685 if (card->cardtype != avm_m1) { 686 if (card->cardtype != avm_m1) {
686 flag = ((u8 *)(ctrl->profile.manu))[5]; 687 flag = ((u8 *)(ctrl->profile.manu))[5];
687 if (flag) 688 if (flag)
688 len += sprintf(page+len, "%-16s%s%s%s%s\n", 689 seq_printf(m, "%-16s%s%s%s%s\n",
689 "linetype", 690 "linetype",
690 (flag & 0x01) ? " point to point" : "", 691 (flag & 0x01) ? " point to point" : "",
691 (flag & 0x02) ? " point to multipoint" : "", 692 (flag & 0x02) ? " point to multipoint" : "",
@@ -693,16 +694,25 @@ int b1ctl_read_proc(char *page, char **start, off_t off,
693 (flag & 0x04) ? " leased line with D-channel" : "" 694 (flag & 0x04) ? " leased line with D-channel" : ""
694 ); 695 );
695 } 696 }
696 len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); 697 seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname);
697 698
698 if (off+count >= len) 699 return 0;
699 *eof = 1; 700}
700 if (len < off) 701
701 return 0; 702static int b1ctl_proc_open(struct inode *inode, struct file *file)
702 *start = page + off; 703{
703 return ((count < len-off) ? count : len-off); 704 return single_open(file, b1ctl_proc_show, PDE(inode)->data);
704} 705}
705 706
707const struct file_operations b1ctl_proc_fops = {
708 .owner = THIS_MODULE,
709 .open = b1ctl_proc_open,
710 .read = seq_read,
711 .llseek = seq_lseek,
712 .release = single_release,
713};
714EXPORT_SYMBOL(b1ctl_proc_fops);
715
706/* ------------------------------------------------------------- */ 716/* ------------------------------------------------------------- */
707 717
708#ifdef CONFIG_PCI 718#ifdef CONFIG_PCI
@@ -781,8 +791,6 @@ EXPORT_SYMBOL(b1_send_message);
781EXPORT_SYMBOL(b1_parse_version); 791EXPORT_SYMBOL(b1_parse_version);
782EXPORT_SYMBOL(b1_interrupt); 792EXPORT_SYMBOL(b1_interrupt);
783 793
784EXPORT_SYMBOL(b1ctl_read_proc);
785
786static int __init b1_init(void) 794static int __init b1_init(void)
787{ 795{
788 char *p; 796 char *p;
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c
index 0e84aaae43fd..124550d0dbf3 100644
--- a/drivers/isdn/hardware/avm/b1dma.c
+++ b/drivers/isdn/hardware/avm/b1dma.c
@@ -11,6 +11,8 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/proc_fs.h>
15#include <linux/seq_file.h>
14#include <linux/skbuff.h> 16#include <linux/skbuff.h>
15#include <linux/delay.h> 17#include <linux/delay.h>
16#include <linux/mm.h> 18#include <linux/mm.h>
@@ -855,21 +857,20 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
855 857
856/* ------------------------------------------------------------- */ 858/* ------------------------------------------------------------- */
857 859
858int b1dmactl_read_proc(char *page, char **start, off_t off, 860static int b1dmactl_proc_show(struct seq_file *m, void *v)
859 int count, int *eof, struct capi_ctr *ctrl)
860{ 861{
862 struct capi_ctr *ctrl = m->private;
861 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); 863 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
862 avmcard *card = cinfo->card; 864 avmcard *card = cinfo->card;
863 u8 flag; 865 u8 flag;
864 int len = 0;
865 char *s; 866 char *s;
866 u32 txoff, txlen, rxoff, rxlen, csr; 867 u32 txoff, txlen, rxoff, rxlen, csr;
867 unsigned long flags; 868 unsigned long flags;
868 869
869 len += sprintf(page+len, "%-16s %s\n", "name", card->name); 870 seq_printf(m, "%-16s %s\n", "name", card->name);
870 len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port); 871 seq_printf(m, "%-16s 0x%x\n", "io", card->port);
871 len += sprintf(page+len, "%-16s %d\n", "irq", card->irq); 872 seq_printf(m, "%-16s %d\n", "irq", card->irq);
872 len += sprintf(page+len, "%-16s 0x%lx\n", "membase", card->membase); 873 seq_printf(m, "%-16s 0x%lx\n", "membase", card->membase);
873 switch (card->cardtype) { 874 switch (card->cardtype) {
874 case avm_b1isa: s = "B1 ISA"; break; 875 case avm_b1isa: s = "B1 ISA"; break;
875 case avm_b1pci: s = "B1 PCI"; break; 876 case avm_b1pci: s = "B1 PCI"; break;
@@ -882,18 +883,18 @@ int b1dmactl_read_proc(char *page, char **start, off_t off,
882 case avm_c2: s = "C2"; break; 883 case avm_c2: s = "C2"; break;
883 default: s = "???"; break; 884 default: s = "???"; break;
884 } 885 }
885 len += sprintf(page+len, "%-16s %s\n", "type", s); 886 seq_printf(m, "%-16s %s\n", "type", s);
886 if ((s = cinfo->version[VER_DRIVER]) != NULL) 887 if ((s = cinfo->version[VER_DRIVER]) != NULL)
887 len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); 888 seq_printf(m, "%-16s %s\n", "ver_driver", s);
888 if ((s = cinfo->version[VER_CARDTYPE]) != NULL) 889 if ((s = cinfo->version[VER_CARDTYPE]) != NULL)
889 len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); 890 seq_printf(m, "%-16s %s\n", "ver_cardtype", s);
890 if ((s = cinfo->version[VER_SERIAL]) != NULL) 891 if ((s = cinfo->version[VER_SERIAL]) != NULL)
891 len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); 892 seq_printf(m, "%-16s %s\n", "ver_serial", s);
892 893
893 if (card->cardtype != avm_m1) { 894 if (card->cardtype != avm_m1) {
894 flag = ((u8 *)(ctrl->profile.manu))[3]; 895 flag = ((u8 *)(ctrl->profile.manu))[3];
895 if (flag) 896 if (flag)
896 len += sprintf(page+len, "%-16s%s%s%s%s%s%s%s\n", 897 seq_printf(m, "%-16s%s%s%s%s%s%s%s\n",
897 "protocol", 898 "protocol",
898 (flag & 0x01) ? " DSS1" : "", 899 (flag & 0x01) ? " DSS1" : "",
899 (flag & 0x02) ? " CT1" : "", 900 (flag & 0x02) ? " CT1" : "",
@@ -907,7 +908,7 @@ int b1dmactl_read_proc(char *page, char **start, off_t off,
907 if (card->cardtype != avm_m1) { 908 if (card->cardtype != avm_m1) {
908 flag = ((u8 *)(ctrl->profile.manu))[5]; 909 flag = ((u8 *)(ctrl->profile.manu))[5];
909 if (flag) 910 if (flag)
910 len += sprintf(page+len, "%-16s%s%s%s%s\n", 911 seq_printf(m, "%-16s%s%s%s%s\n",
911 "linetype", 912 "linetype",
912 (flag & 0x01) ? " point to point" : "", 913 (flag & 0x01) ? " point to point" : "",
913 (flag & 0x02) ? " point to multipoint" : "", 914 (flag & 0x02) ? " point to multipoint" : "",
@@ -915,7 +916,7 @@ int b1dmactl_read_proc(char *page, char **start, off_t off,
915 (flag & 0x04) ? " leased line with D-channel" : "" 916 (flag & 0x04) ? " leased line with D-channel" : ""
916 ); 917 );
917 } 918 }
918 len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); 919 seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname);
919 920
920 921
921 spin_lock_irqsave(&card->lock, flags); 922 spin_lock_irqsave(&card->lock, flags);
@@ -930,27 +931,30 @@ int b1dmactl_read_proc(char *page, char **start, off_t off,
930 931
931 spin_unlock_irqrestore(&card->lock, flags); 932 spin_unlock_irqrestore(&card->lock, flags);
932 933
933 len += sprintf(page+len, "%-16s 0x%lx\n", 934 seq_printf(m, "%-16s 0x%lx\n", "csr (cached)", (unsigned long)card->csr);
934 "csr (cached)", (unsigned long)card->csr); 935 seq_printf(m, "%-16s 0x%lx\n", "csr", (unsigned long)csr);
935 len += sprintf(page+len, "%-16s 0x%lx\n", 936 seq_printf(m, "%-16s %lu\n", "txoff", (unsigned long)txoff);
936 "csr", (unsigned long)csr); 937 seq_printf(m, "%-16s %lu\n", "txlen", (unsigned long)txlen);
937 len += sprintf(page+len, "%-16s %lu\n", 938 seq_printf(m, "%-16s %lu\n", "rxoff", (unsigned long)rxoff);
938 "txoff", (unsigned long)txoff); 939 seq_printf(m, "%-16s %lu\n", "rxlen", (unsigned long)rxlen);
939 len += sprintf(page+len, "%-16s %lu\n", 940
940 "txlen", (unsigned long)txlen); 941 return 0;
941 len += sprintf(page+len, "%-16s %lu\n", 942}
942 "rxoff", (unsigned long)rxoff); 943
943 len += sprintf(page+len, "%-16s %lu\n", 944static int b1dmactl_proc_open(struct inode *inode, struct file *file)
944 "rxlen", (unsigned long)rxlen); 945{
945 946 return single_open(file, b1dmactl_proc_show, PDE(inode)->data);
946 if (off+count >= len)
947 *eof = 1;
948 if (len < off)
949 return 0;
950 *start = page + off;
951 return ((count < len-off) ? count : len-off);
952} 947}
953 948
949const struct file_operations b1dmactl_proc_fops = {
950 .owner = THIS_MODULE,
951 .open = b1dmactl_proc_open,
952 .read = seq_read,
953 .llseek = seq_lseek,
954 .release = single_release,
955};
956EXPORT_SYMBOL(b1dmactl_proc_fops);
957
954/* ------------------------------------------------------------- */ 958/* ------------------------------------------------------------- */
955 959
956EXPORT_SYMBOL(b1dma_reset); 960EXPORT_SYMBOL(b1dma_reset);
@@ -963,7 +967,6 @@ EXPORT_SYMBOL(b1dma_reset_ctr);
963EXPORT_SYMBOL(b1dma_register_appl); 967EXPORT_SYMBOL(b1dma_register_appl);
964EXPORT_SYMBOL(b1dma_release_appl); 968EXPORT_SYMBOL(b1dma_release_appl);
965EXPORT_SYMBOL(b1dma_send_message); 969EXPORT_SYMBOL(b1dma_send_message);
966EXPORT_SYMBOL(b1dmactl_read_proc);
967 970
968static int __init b1dma_init(void) 971static int __init b1dma_init(void)
969{ 972{
diff --git a/drivers/isdn/hardware/avm/b1isa.c b/drivers/isdn/hardware/avm/b1isa.c
index 6461a32bc838..ff5390546f92 100644
--- a/drivers/isdn/hardware/avm/b1isa.c
+++ b/drivers/isdn/hardware/avm/b1isa.c
@@ -121,7 +121,7 @@ static int b1isa_probe(struct pci_dev *pdev)
121 cinfo->capi_ctrl.load_firmware = b1_load_firmware; 121 cinfo->capi_ctrl.load_firmware = b1_load_firmware;
122 cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; 122 cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
123 cinfo->capi_ctrl.procinfo = b1isa_procinfo; 123 cinfo->capi_ctrl.procinfo = b1isa_procinfo;
124 cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; 124 cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops;
125 strcpy(cinfo->capi_ctrl.name, card->name); 125 strcpy(cinfo->capi_ctrl.name, card->name);
126 126
127 retval = attach_capi_ctr(&cinfo->capi_ctrl); 127 retval = attach_capi_ctr(&cinfo->capi_ctrl);
diff --git a/drivers/isdn/hardware/avm/b1pci.c b/drivers/isdn/hardware/avm/b1pci.c
index 5b314a2c4049..c97e4315079d 100644
--- a/drivers/isdn/hardware/avm/b1pci.c
+++ b/drivers/isdn/hardware/avm/b1pci.c
@@ -112,7 +112,7 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev)
112 cinfo->capi_ctrl.load_firmware = b1_load_firmware; 112 cinfo->capi_ctrl.load_firmware = b1_load_firmware;
113 cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; 113 cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
114 cinfo->capi_ctrl.procinfo = b1pci_procinfo; 114 cinfo->capi_ctrl.procinfo = b1pci_procinfo;
115 cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; 115 cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops;
116 strcpy(cinfo->capi_ctrl.name, card->name); 116 strcpy(cinfo->capi_ctrl.name, card->name);
117 cinfo->capi_ctrl.owner = THIS_MODULE; 117 cinfo->capi_ctrl.owner = THIS_MODULE;
118 118
@@ -251,7 +251,7 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev)
251 cinfo->capi_ctrl.load_firmware = b1dma_load_firmware; 251 cinfo->capi_ctrl.load_firmware = b1dma_load_firmware;
252 cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr; 252 cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr;
253 cinfo->capi_ctrl.procinfo = b1pciv4_procinfo; 253 cinfo->capi_ctrl.procinfo = b1pciv4_procinfo;
254 cinfo->capi_ctrl.ctr_read_proc = b1dmactl_read_proc; 254 cinfo->capi_ctrl.proc_fops = &b1dmactl_proc_fops;
255 strcpy(cinfo->capi_ctrl.name, card->name); 255 strcpy(cinfo->capi_ctrl.name, card->name);
256 256
257 retval = attach_capi_ctr(&cinfo->capi_ctrl); 257 retval = attach_capi_ctr(&cinfo->capi_ctrl);
diff --git a/drivers/isdn/hardware/avm/b1pcmcia.c b/drivers/isdn/hardware/avm/b1pcmcia.c
index 7740403b40e1..d6391e0afeea 100644
--- a/drivers/isdn/hardware/avm/b1pcmcia.c
+++ b/drivers/isdn/hardware/avm/b1pcmcia.c
@@ -108,7 +108,7 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq,
108 cinfo->capi_ctrl.load_firmware = b1_load_firmware; 108 cinfo->capi_ctrl.load_firmware = b1_load_firmware;
109 cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; 109 cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
110 cinfo->capi_ctrl.procinfo = b1pcmcia_procinfo; 110 cinfo->capi_ctrl.procinfo = b1pcmcia_procinfo;
111 cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; 111 cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops;
112 strcpy(cinfo->capi_ctrl.name, card->name); 112 strcpy(cinfo->capi_ctrl.name, card->name);
113 113
114 retval = attach_capi_ctr(&cinfo->capi_ctrl); 114 retval = attach_capi_ctr(&cinfo->capi_ctrl);
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c
index 6833301a45fc..de6e6b311819 100644
--- a/drivers/isdn/hardware/avm/c4.c
+++ b/drivers/isdn/hardware/avm/c4.c
@@ -11,6 +11,8 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/proc_fs.h>
15#include <linux/seq_file.h>
14#include <linux/skbuff.h> 16#include <linux/skbuff.h>
15#include <linux/delay.h> 17#include <linux/delay.h>
16#include <linux/mm.h> 18#include <linux/mm.h>
@@ -1062,19 +1064,18 @@ static char *c4_procinfo(struct capi_ctr *ctrl)
1062 return cinfo->infobuf; 1064 return cinfo->infobuf;
1063} 1065}
1064 1066
1065static int c4_read_proc(char *page, char **start, off_t off, 1067static int c4_proc_show(struct seq_file *m, void *v)
1066 int count, int *eof, struct capi_ctr *ctrl)
1067{ 1068{
1069 struct capi_ctr *ctrl = m->private;
1068 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); 1070 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
1069 avmcard *card = cinfo->card; 1071 avmcard *card = cinfo->card;
1070 u8 flag; 1072 u8 flag;
1071 int len = 0;
1072 char *s; 1073 char *s;
1073 1074
1074 len += sprintf(page+len, "%-16s %s\n", "name", card->name); 1075 seq_printf(m, "%-16s %s\n", "name", card->name);
1075 len += sprintf(page+len, "%-16s 0x%x\n", "io", card->port); 1076 seq_printf(m, "%-16s 0x%x\n", "io", card->port);
1076 len += sprintf(page+len, "%-16s %d\n", "irq", card->irq); 1077 seq_printf(m, "%-16s %d\n", "irq", card->irq);
1077 len += sprintf(page+len, "%-16s 0x%lx\n", "membase", card->membase); 1078 seq_printf(m, "%-16s 0x%lx\n", "membase", card->membase);
1078 switch (card->cardtype) { 1079 switch (card->cardtype) {
1079 case avm_b1isa: s = "B1 ISA"; break; 1080 case avm_b1isa: s = "B1 ISA"; break;
1080 case avm_b1pci: s = "B1 PCI"; break; 1081 case avm_b1pci: s = "B1 PCI"; break;
@@ -1087,18 +1088,18 @@ static int c4_read_proc(char *page, char **start, off_t off,
1087 case avm_c2: s = "C2"; break; 1088 case avm_c2: s = "C2"; break;
1088 default: s = "???"; break; 1089 default: s = "???"; break;
1089 } 1090 }
1090 len += sprintf(page+len, "%-16s %s\n", "type", s); 1091 seq_printf(m, "%-16s %s\n", "type", s);
1091 if ((s = cinfo->version[VER_DRIVER]) != NULL) 1092 if ((s = cinfo->version[VER_DRIVER]) != NULL)
1092 len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); 1093 seq_printf(m, "%-16s %s\n", "ver_driver", s);
1093 if ((s = cinfo->version[VER_CARDTYPE]) != NULL) 1094 if ((s = cinfo->version[VER_CARDTYPE]) != NULL)
1094 len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); 1095 seq_printf(m, "%-16s %s\n", "ver_cardtype", s);
1095 if ((s = cinfo->version[VER_SERIAL]) != NULL) 1096 if ((s = cinfo->version[VER_SERIAL]) != NULL)
1096 len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); 1097 seq_printf(m, "%-16s %s\n", "ver_serial", s);
1097 1098
1098 if (card->cardtype != avm_m1) { 1099 if (card->cardtype != avm_m1) {
1099 flag = ((u8 *)(ctrl->profile.manu))[3]; 1100 flag = ((u8 *)(ctrl->profile.manu))[3];
1100 if (flag) 1101 if (flag)
1101 len += sprintf(page+len, "%-16s%s%s%s%s%s%s%s\n", 1102 seq_printf(m, "%-16s%s%s%s%s%s%s%s\n",
1102 "protocol", 1103 "protocol",
1103 (flag & 0x01) ? " DSS1" : "", 1104 (flag & 0x01) ? " DSS1" : "",
1104 (flag & 0x02) ? " CT1" : "", 1105 (flag & 0x02) ? " CT1" : "",
@@ -1112,7 +1113,7 @@ static int c4_read_proc(char *page, char **start, off_t off,
1112 if (card->cardtype != avm_m1) { 1113 if (card->cardtype != avm_m1) {
1113 flag = ((u8 *)(ctrl->profile.manu))[5]; 1114 flag = ((u8 *)(ctrl->profile.manu))[5];
1114 if (flag) 1115 if (flag)
1115 len += sprintf(page+len, "%-16s%s%s%s%s\n", 1116 seq_printf(m, "%-16s%s%s%s%s\n",
1116 "linetype", 1117 "linetype",
1117 (flag & 0x01) ? " point to point" : "", 1118 (flag & 0x01) ? " point to point" : "",
1118 (flag & 0x02) ? " point to multipoint" : "", 1119 (flag & 0x02) ? " point to multipoint" : "",
@@ -1120,16 +1121,24 @@ static int c4_read_proc(char *page, char **start, off_t off,
1120 (flag & 0x04) ? " leased line with D-channel" : "" 1121 (flag & 0x04) ? " leased line with D-channel" : ""
1121 ); 1122 );
1122 } 1123 }
1123 len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); 1124 seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname);
1124 1125
1125 if (off+count >= len) 1126 return 0;
1126 *eof = 1;
1127 if (len < off)
1128 return 0;
1129 *start = page + off;
1130 return ((count < len-off) ? count : len-off);
1131} 1127}
1132 1128
1129static int c4_proc_open(struct inode *inode, struct file *file)
1130{
1131 return single_open(file, c4_proc_show, PDE(inode)->data);
1132}
1133
1134static const struct file_operations c4_proc_fops = {
1135 .owner = THIS_MODULE,
1136 .open = c4_proc_open,
1137 .read = seq_read,
1138 .llseek = seq_lseek,
1139 .release = single_release,
1140};
1141
1133/* ------------------------------------------------------------- */ 1142/* ------------------------------------------------------------- */
1134 1143
1135static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, 1144static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
@@ -1201,7 +1210,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
1201 cinfo->capi_ctrl.load_firmware = c4_load_firmware; 1210 cinfo->capi_ctrl.load_firmware = c4_load_firmware;
1202 cinfo->capi_ctrl.reset_ctr = c4_reset_ctr; 1211 cinfo->capi_ctrl.reset_ctr = c4_reset_ctr;
1203 cinfo->capi_ctrl.procinfo = c4_procinfo; 1212 cinfo->capi_ctrl.procinfo = c4_procinfo;
1204 cinfo->capi_ctrl.ctr_read_proc = c4_read_proc; 1213 cinfo->capi_ctrl.proc_fops = &c4_proc_fops;
1205 strcpy(cinfo->capi_ctrl.name, card->name); 1214 strcpy(cinfo->capi_ctrl.name, card->name);
1206 1215
1207 retval = attach_capi_ctr(&cinfo->capi_ctrl); 1216 retval = attach_capi_ctr(&cinfo->capi_ctrl);
diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c
index 1c53fd49adb6..baeeb3c2a3ee 100644
--- a/drivers/isdn/hardware/avm/t1isa.c
+++ b/drivers/isdn/hardware/avm/t1isa.c
@@ -429,7 +429,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr)
429 cinfo->capi_ctrl.load_firmware = t1isa_load_firmware; 429 cinfo->capi_ctrl.load_firmware = t1isa_load_firmware;
430 cinfo->capi_ctrl.reset_ctr = t1isa_reset_ctr; 430 cinfo->capi_ctrl.reset_ctr = t1isa_reset_ctr;
431 cinfo->capi_ctrl.procinfo = t1isa_procinfo; 431 cinfo->capi_ctrl.procinfo = t1isa_procinfo;
432 cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; 432 cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops;
433 strcpy(cinfo->capi_ctrl.name, card->name); 433 strcpy(cinfo->capi_ctrl.name, card->name);
434 434
435 retval = attach_capi_ctr(&cinfo->capi_ctrl); 435 retval = attach_capi_ctr(&cinfo->capi_ctrl);
diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c
index e6d298d75146..5a3f83098018 100644
--- a/drivers/isdn/hardware/avm/t1pci.c
+++ b/drivers/isdn/hardware/avm/t1pci.c
@@ -119,7 +119,7 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev)
119 cinfo->capi_ctrl.load_firmware = b1dma_load_firmware; 119 cinfo->capi_ctrl.load_firmware = b1dma_load_firmware;
120 cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr; 120 cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr;
121 cinfo->capi_ctrl.procinfo = t1pci_procinfo; 121 cinfo->capi_ctrl.procinfo = t1pci_procinfo;
122 cinfo->capi_ctrl.ctr_read_proc = b1dmactl_read_proc; 122 cinfo->capi_ctrl.proc_fops = &b1dmactl_proc_fops;
123 strcpy(cinfo->capi_ctrl.name, card->name); 123 strcpy(cinfo->capi_ctrl.name, card->name);
124 124
125 retval = attach_capi_ctr(&cinfo->capi_ctrl); 125 retval = attach_capi_ctr(&cinfo->capi_ctrl);