aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/avm/b1dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hardware/avm/b1dma.c')
-rw-r--r--drivers/isdn/hardware/avm/b1dma.c71
1 files changed, 37 insertions, 34 deletions
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{