~mmach/netext73/bcmwl-kernel-source

« back to all changes in this revision

Viewing changes to debian/patches/0009-add-support-for-linux-3.10.0.patch.diff

  • Committer: mmach
  • Date: 2019-06-26 07:36:36 UTC
  • Revision ID: netbit73@gmail.com-20190626073636-rm4rlhgaov8qics9
dla 5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- bcmwl-6.30.223.271+bdcom.orig/debian/patches/0009-add-support-for-linux-3.10.0.patch
 
2
+++ bcmwl-6.30.223.271+bdcom/debian/patches/0009-add-support-for-linux-3.10.0.patch
 
3
@@ -0,0 +1,129 @@
 
4
+From 53c81dd6a3ad5919aef8c25f0589d8a538ddb532 Mon Sep 17 00:00:00 2001
 
5
+From: Alberto Milone <alberto.milone@canonical.com>
 
6
+Date: Wed, 9 Oct 2013 12:46:52 +0200
 
7
+Subject: [PATCH 1/1] Add support for Linux 3.10
 
8
+
 
9
+Thanks to Maarten Lankhorst for the patch.
 
10
+---
 
11
+ src/wl/sys/wl_linux.c |   82 ++++++++++++++++++++++++++++++++++++++++++++++---
 
12
+ 1 file changed, 77 insertions(+), 5 deletions(-)
 
13
+
 
14
+diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
 
15
+index 521f02e..3ead3c3 100644
 
16
+--- a/src/wl/sys/wl_linux.c
 
17
++++ b/src/wl/sys/wl_linux.c
 
18
+@@ -3235,7 +3235,7 @@ wl_tkip_keyset(wl_info_t *wl, wsec_key_t *key)
 
19
+ void
 
20
+ wl_tkip_printstats(wl_info_t *wl, bool group_key)
 
21
+ {
 
22
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
 
23
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
 
24
+       char debug_buf[512];
 
25
+       int idx;
 
26
+       if (wl->tkipmodops) {
 
27
+@@ -3408,6 +3408,7 @@ wl_linux_watchdog(void *ctx)
 
28
+       return 0;
 
29
+ }
 
30
 
31
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
 
32
+ static int
 
33
+ wl_proc_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
 
34
+ {
 
35
+@@ -3462,19 +3463,90 @@ wl_proc_write(struct file *filp, const char *buff, unsigned long length, void *d
 
36
+       return length;
 
37
+ }
 
38
 
39
++#else
 
40
++
 
41
++static int
 
42
++wl_proc_read(struct seq_file *seq, void *offset)
 
43
++{
 
44
++      wl_info_t * wl = (wl_info_t *)seq->private;
 
45
++      int bcmerror, to_user;
 
46
++
 
47
++      WL_LOCK(wl);
 
48
++      bcmerror = wlc_ioctl(wl->wlc, WLC_GET_MONITOR, &to_user, sizeof(int), NULL);
 
49
++      WL_UNLOCK(wl);
 
50
++
 
51
++      seq_printf(seq, "%d\n", to_user);
 
52
++      return bcmerror;
 
53
++}
 
54
++
 
55
++static ssize_t wl_proc_write(struct file *file, const char __user *buff,
 
56
++                           size_t length, loff_t *ppos)
 
57
++{
 
58
++      struct seq_file *seq = file->private_data;
 
59
++      wl_info_t * wl = (wl_info_t *)seq->private;
 
60
++      int bcmerror, from_user = 0;
 
61
++
 
62
++      if (length != 1) {
 
63
++              WL_ERROR(("%s: Invalid data length\n", __FUNCTION__));
 
64
++              return -EIO;
 
65
++      }
 
66
++
 
67
++      if (copy_from_user(&from_user, buff, 1)) {
 
68
++              WL_ERROR(("%s: copy from user failed\n", __FUNCTION__));
 
69
++              return -EFAULT;
 
70
++      }
 
71
++
 
72
++      if (from_user >= 0x30)
 
73
++              from_user -= 0x30;
 
74
++
 
75
++      WL_LOCK(wl);
 
76
++      bcmerror = wlc_ioctl(wl->wlc, WLC_SET_MONITOR, &from_user, sizeof(int), NULL);
 
77
++      WL_UNLOCK(wl);
 
78
++
 
79
++      if (bcmerror < 0) {
 
80
++              WL_ERROR(("%s: SET_MONITOR failed with %d\n", __FUNCTION__, bcmerror));
 
81
++              return -EIO;
 
82
++      }
 
83
++      *ppos += length;
 
84
++      return length;
 
85
++}
 
86
++
 
87
++static int wl_proc_open(struct inode *inode, struct file *file)
 
88
++{
 
89
++      return single_open(file, wl_proc_read, PDE_DATA(inode));
 
90
++}
 
91
++
 
92
++static const struct file_operations wl_proc_fops = {
 
93
++      .owner = THIS_MODULE,
 
94
++      .open = wl_proc_open,
 
95
++      .read = seq_read,
 
96
++      .write = wl_proc_write,
 
97
++      .llseek = seq_lseek,
 
98
++      .release = single_release,
 
99
++};
 
100
++#endif
 
101
++
 
102
+ static int
 
103
+ wl_reg_proc_entry(wl_info_t *wl)
 
104
+ {
 
105
+       char tmp[32];
 
106
+       sprintf(tmp, "%s%d", HYBRID_PROC, wl->pub->unit);
 
107
+-      if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
 
108
++
 
109
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
 
110
++      wl->proc_entry = create_proc_entry(tmp, 0644, NULL);
 
111
++      if (wl->proc_entry) {
 
112
++              wl->proc_entry->read_proc = wl_proc_read;
 
113
++              wl->proc_entry->write_proc = wl_proc_write;
 
114
++              wl->proc_entry->data = wl;
 
115
++      }
 
116
++#else
 
117
++      wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_proc_fops, wl);
 
118
++#endif
 
119
++      if (!wl->proc_entry) {
 
120
+               WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp));
 
121
+               ASSERT(0);
 
122
+               return -1;
 
123
+       }
 
124
+-      wl->proc_entry->read_proc = wl_proc_read;
 
125
+-      wl->proc_entry->write_proc = wl_proc_write;
 
126
+-      wl->proc_entry->data = wl;
 
127
+       return 0;
 
128
+ }
 
129
+ #ifdef WLOFFLD
 
130
+-- 
 
131
+1.7.9.5
 
132
+