1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
- capi_ctr_reseted has been renamed in linux kernel commit
4e329972052c3649367b91de783f6293b8653cb2
- kernel now wants a struc file_operations for proc files
--- mISDN-1_1_9_2.orig/drivers/isdn/hardware/mISDN/contr.c 2009-01-22 14:36:34.000000000 +0100
+++ mISDN-1_1_9_2/drivers/isdn/hardware/mISDN/contr.c 2011-07-15 18:33:55.765001537 +0200
@@ -367,17 +367,12 @@ procinfo(struct capi_ctr *ctrl)
}
static int
-read_proc(char *page, char **start, off_t off, int count, int *eof, struct capi_ctr *ctrl)
+proc_show(struct seq_file *file, void *data)
{
- int len = 0;
+ struct capi_ctr *ctrl = file->private;
- len += sprintf(page+len, "mISDN_read_proc\n");
- if (off+count >= len)
- *eof = 1;
- if (len < off)
- return 0;
- *start = page + off;
- return ((count < len-off) ? count : len-off);
+ seq_printf(file, "mISDN_proc_show\n");
+ return 0;
};
@@ -399,7 +394,7 @@ ResetController(struct capi_ctr *ctrl)
#ifdef OLDCAPI_DRIVER_INTERFACE
contr->ctrl->reseted(contr->ctrl);
#else
- capi_ctr_reseted(contr->ctrl);
+ capi_ctr_down(contr->ctrl);
#endif
}
@@ -601,6 +596,19 @@ ControllerPutStatus(Controller_t *contr,
contrDebug(contr, CAPI_DBG_CONTR, "%s: %s", __FUNCTION__, msg);
}
+static int misdn_proc_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, proc_show, PDE(inode)->data);
+}
+
+static const struct file_operations misdn_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = misdn_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
int
ControllerConstr(Controller_t **contr_p, mISDNstack_t *st, mISDN_pid_t *pid, mISDNobject_t *ocapi)
{
@@ -719,7 +727,7 @@ ControllerConstr(Controller_t **contr_p,
contr->ctrl->load_firmware = LoadFirmware;
contr->ctrl->reset_ctr = ResetController;
contr->ctrl->procinfo = procinfo;
- contr->ctrl->ctr_read_proc = read_proc;
+ contr->ctrl->proc_fops = &misdn_proc_fops;
retval = attach_capi_ctr(contr->ctrl);
#endif
if (!retval) {
|