aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/avm/c4.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hardware/avm/c4.c')
-rw-r--r--drivers/isdn/hardware/avm/c4.c53
1 files changed, 31 insertions, 22 deletions
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);