1 Backport kernel patch 9a58a80a701bdb2d220cdab4914218df5b48d781
2 proc_fops: convert drivers/isdn/ to seq_file
4 --- a/net/bluetooth/cmtp/capi.c
5 +++ b/net/bluetooth/cmtp/capi.c
9 #include <linux/module.h>
10 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
11 #include <linux/proc_fs.h>
12 #include <linux/seq_file.h>
14 #include <linux/types.h>
15 #include <linux/errno.h>
16 #include <linux/kernel.h>
17 @@ -521,6 +523,7 @@ static char *cmtp_procinfo(struct capi_c
18 return "CAPI Message Transport Protocol";
21 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
22 static int cmtp_proc_show(struct seq_file *m, void *v)
24 struct capi_ctr *ctrl = m->private;
25 @@ -553,6 +556,36 @@ static const struct file_operations cmtp
26 .release = single_release,
31 +static int cmtp_ctr_read_proc(char *page, char **start, off_t off, int count, int *eof, struct capi_ctr *ctrl)
33 + struct cmtp_session *session = ctrl->driverdata;
34 + struct cmtp_application *app;
35 + struct list_head *p, *n;
38 + len += sprintf(page + len, "%s\n\n", cmtp_procinfo(ctrl));
39 + len += sprintf(page + len, "addr %s\n", session->name);
40 + len += sprintf(page + len, "ctrl %d\n", session->num);
42 + list_for_each_safe(p, n, &session->applications) {
43 + app = list_entry(p, struct cmtp_application, list);
44 + len += sprintf(page + len, "appl %d -> %d\n", app->appl, app->mapping);
47 + if (off + count >= len)
53 + *start = page + off;
55 + return ((count < len - off) ? count : len - off);
59 int cmtp_attach_device(struct cmtp_session *session)
62 @@ -591,7 +624,11 @@ int cmtp_attach_device(struct cmtp_sessi
63 session->ctrl.send_message = cmtp_send_message;
65 session->ctrl.procinfo = cmtp_procinfo;
66 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
67 session->ctrl.proc_fops = &cmtp_proc_fops;
69 + session->ctrl.ctr_read_proc = cmtp_ctr_read_proc;
72 if (attach_capi_ctr(&session->ctrl) < 0) {
73 BT_ERR("Can't attach new controller");