wl1251: reduce eeprom read wait time
[pandora-wifi.git] / patches / 21-capi-proc_fops.patch
1 Backport kernel patch 9a58a80a701bdb2d220cdab4914218df5b48d781
2 proc_fops: convert drivers/isdn/ to seq_file
3
4 --- a/net/bluetooth/cmtp/capi.c
5 +++ b/net/bluetooth/cmtp/capi.c
6 @@ -21,8 +21,10 @@
7  */
8  
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>
13 +#endif
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";
19  }
20  
21 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
22  static int cmtp_proc_show(struct seq_file *m, void *v)
23  {
24         struct capi_ctr *ctrl = m->private;
25 @@ -553,6 +556,36 @@ static const struct file_operations cmtp
26         .release        = single_release,
27  };
28  
29 +#else
30 +
31 +static int cmtp_ctr_read_proc(char *page, char **start, off_t off, int count, int *eof, struct capi_ctr *ctrl)
32 +{
33 +       struct cmtp_session *session = ctrl->driverdata;
34 +       struct cmtp_application *app;
35 +       struct list_head *p, *n;
36 +       int len = 0;
37 +
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);
41 +
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);
45 +       }
46 +
47 +       if (off + count >= len)
48 +               *eof = 1;
49 +
50 +       if (len < off)
51 +               return 0;
52 +
53 +       *start = page + off;
54 +
55 +       return ((count < len - off) ? count : len - off);
56 +}
57 +#endif
58 +
59  int cmtp_attach_device(struct cmtp_session *session)
60  {
61         unsigned char buf[4];
62 @@ -591,7 +624,11 @@ int cmtp_attach_device(struct cmtp_sessi
63         session->ctrl.send_message  = cmtp_send_message;
64  
65         session->ctrl.procinfo      = cmtp_procinfo;
66 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
67         session->ctrl.proc_fops = &cmtp_proc_fops;
68 +#else
69 +       session->ctrl.ctr_read_proc = cmtp_ctr_read_proc;
70 +#endif
71  
72         if (attach_capi_ctr(&session->ctrl) < 0) {
73                 BT_ERR("Can't attach new controller");