]> git.pld-linux.org Git - packages/wl.git/blob - kernel-net-wl-linux-3.10.patch
- fix building with kernel 3.10 (patch from arch linux)
[packages/wl.git] / kernel-net-wl-linux-3.10.patch
1 --- a/Makefile  2011-10-22 18:55:54.000000000 +0200
2 +++ b/Makefile  2013-07-05 19:45:48.017337088 +0200
3 @@ -16,7 +16,7 @@
4  ifneq ($(KERNELRELEASE),)
5  
6    LINUXVER_GOODFOR_CFG80211:=$(strip $(shell \
7 -    if [ "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "32" ]; then \
8 +    if [ "$(VERSION)" -ge "3" -o "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "32" ]; then \
9        echo TRUE; \
10      else \
11        echo FALSE; \
12 @@ -24,7 +24,7 @@
13    ))
14  
15      LINUXVER_WEXT_ONLY:=$(strip $(shell \
16 -    if [ "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "17" ]; then \
17 +    if [ "$(VERSION)" -ge "3" -o "$(VERSION)" -ge "2" -a "$(PATCHLEVEL)" -ge "6" -a "$(SUBLEVEL)" -ge "17" ]; then \
18        echo FALSE; \
19      else \
20        echo TRUE; \
21 --- a/src/include/bcmutils.h    2011-10-22 18:55:54.000000000 +0200
22 +++ b/src/include/bcmutils.h    2013-07-05 19:45:48.017337088 +0200
23 @@ -555,7 +555,11 @@
24  extern void prhex(const char *msg, uchar *buf, uint len);
25  
26  extern bcm_tlv_t *BCMROMFN(bcm_next_tlv)(bcm_tlv_t *elt, int *buflen);
27 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
28  extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(void *buf, int buflen, uint key);
29 +#else
30 +extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(const void *buf, int buflen, uint key);
31 +#endif
32  extern bcm_tlv_t *BCMROMFN(bcm_parse_ordered_tlvs)(void *buf, int buflen, uint key);
33  
34  extern const char *bcmerrorstr(int bcmerror);
35 --- a/src/wl/sys/wl_cfg80211.c  2011-10-22 18:55:54.000000000 +0200
36 +++ b/src/wl/sys/wl_cfg80211.c  2013-07-05 19:58:00.993999187 +0200
37 @@ -42,8 +42,7 @@
38             enum nl80211_iftype type, u32 *flags, struct vif_params *params);
39  static s32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
40             struct cfg80211_scan_request *request, struct cfg80211_ssid *this_ssid);
41 -static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
42 -           struct cfg80211_scan_request *request);
43 +static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request);
44  static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed);
45  static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
46             struct cfg80211_ibss_params *params);
47 @@ -56,15 +55,12 @@
48             struct cfg80211_connect_params *sme);
49  static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code);
50  
51 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
52 -static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
53 -           enum nl80211_tx_power_setting type, s32 dbm);
54 -#else
55 -static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
56 -           enum tx_power_setting type, s32 dbm);
57 -#endif
58 +static int wl_cfg80211_set_tx_power(struct wiphy *wiphy,
59 +           struct wireless_dev *wdev,
60 +           enum nl80211_tx_power_setting type, int dbm);
61  
62 -static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
63 +static int wl_cfg80211_get_tx_power(struct wiphy *wiphy,
64 +           struct wireless_dev *wdev, int *dbm);
65  
66  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
67  static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
68 @@ -570,10 +566,11 @@
69  }
70  
71  static s32
72 -wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
73 -                 struct cfg80211_scan_request *request)
74 +wl_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
75  {
76         s32 err = 0;
77 +       struct wl_priv *wl = wiphy_to_wl(wiphy);
78 +       struct net_device *ndev = wl_to_ndev(wl);
79  
80         CHECK_SYS_UP();
81         err = __wl_cfg80211_scan(wiphy, ndev, request, NULL);
82 @@ -742,7 +739,7 @@
83         else
84                 memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN);
85  
86 -       wl_ch_to_chanspec(params->channel, &join_params, &join_params_size);
87 +       wl_ch_to_chanspec(params->chandef.chan, &join_params, &join_params_size);
88  
89         err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
90         if (err) {
91 @@ -1099,16 +1096,10 @@
92         return err;
93  }
94  
95 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
96 -static s32
97 -wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum nl80211_tx_power_setting type, s32 dbm)
98 -#else
99 -#define NL80211_TX_POWER_AUTOMATIC TX_POWER_AUTOMATIC
100 -#define NL80211_TX_POWER_LIMITED TX_POWER_LIMITED
101 -#define NL80211_TX_POWER_FIXED TX_POWER_FIXED
102 -static s32
103 -wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, s32 dbm)
104 -#endif
105 +static int
106 +wl_cfg80211_set_tx_power(struct wiphy *wiphy,
107 +            struct wireless_dev *wdev,
108 +            enum nl80211_tx_power_setting type, int dbm)
109  {
110  
111         struct wl_priv *wl = wiphy_to_wl(wiphy);
112 @@ -1155,16 +1146,17 @@
113         }
114         wl->conf->tx_power = dbm;
115  
116 -       return err;
117 +       return (int) err;
118  }
119  
120 -static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
121 +static int wl_cfg80211_get_tx_power(struct wiphy *wiphy,
122 +            struct wireless_dev *wdev, int *dbm)
123  {
124         struct wl_priv *wl = wiphy_to_wl(wiphy);
125         struct net_device *ndev = wl_to_ndev(wl);
126         s32 txpwrdbm;
127         u8 result;
128 -       s32 err = 0;
129 +       int err = 0;
130  
131         CHECK_SYS_UP();
132         err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);
133 @@ -1173,8 +1165,7 @@
134                 return err;
135         }
136         result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
137 -       *dbm = (s32) bcm_qdbm_to_mw(result);
138 -
139 +       *dbm = (int) bcm_qdbm_to_mw(result);
140         return err;
141  }
142  
143 @@ -1466,7 +1457,10 @@
144                 scb_val.val = 0;
145                 err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t));
146                 if (err) {
147 -                       WL_ERR(("Could not get rssi (%d)\n", err));
148 +                       if (err != -EINVAL) {
149 +                               // Don't fill syslog with EINVAL error
150 +                               WL_ERR(("Could not get rssi (%d)\n", err));
151 +                       }
152                         return err;
153                 }
154                 rssi = dtoh32(scb_val.val);
155 @@ -1811,7 +1805,7 @@
156         notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.beacon.variable) +
157                                     wl_get_ielen(wl);
158         freq = ieee80211_channel_to_frequency(notif_bss_info->channel 
159 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
160 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
161                 ,(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ
162  #endif
163         );
164 @@ -2042,9 +2036,10 @@
165         struct bcm_tlv *tim;
166         u16 beacon_interval;
167         s32 dtim_period;
168 -       size_t ie_len;
169 -       u8 *ie;
170         s32 err = 0;
171 +       size_t ie_len;
172 +       const u8 *ie;
173 +       const struct cfg80211_bss_ies *ies;
174  
175         ssid = &wl->profile->ssid;
176         bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
177 @@ -2074,10 +2069,16 @@
178                 beacon_interval = cpu_to_le16(bi->beacon_period);
179         } else {
180                 WL_DBG(("Found the AP in the list - BSSID %pM\n", bss->bssid));
181 -               ie = bss->information_elements;
182 -               ie_len = bss->len_information_elements;
183 +               ies = (const struct cfg80211_bss_ies*)rcu_dereference(bss->ies);
184 +               if (!ies) {
185 +                       /* This should never happen */
186 +                       err = -EIO;
187 +                       goto update_bss_info_out;
188 +               }
189 +               ie = ies->data;
190 +               ie_len = (size_t)(ies->len);
191                 beacon_interval = bss->beacon_interval;
192 -               cfg80211_put_bss(bss);
193 +               cfg80211_put_bss(wl_to_wiphy(wl), bss);
194         }
195  
196         tim = bcm_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
197 --- a/src/wl/sys/wl_iw.h        2011-10-22 18:55:54.000000000 +0200
198 +++ b/src/wl/sys/wl_iw.h        2013-07-05 19:45:48.020670421 +0200
199 @@ -16,6 +16,7 @@
200  #define _wl_iw_h_
201  
202  #include <linux/wireless.h>
203 +#include <linux/semaphore.h>
204  
205  #include <typedefs.h>
206  #include <proto/ethernet.h>
207 --- a/src/wl/sys/wl_linux.c     2011-10-22 18:55:54.000000000 +0200
208 +++ b/src/wl/sys/wl_linux.c     2013-07-05 19:52:29.540667919 +0200
209 @@ -843,7 +842,7 @@
210         pci_set_drvdata(pdev, NULL);
211  }
212  
213 -static struct pci_driver wl_pci_driver = {
214 +static struct pci_driver wl_pci_driver __refdata = {
215         name:           "wl",
216         probe:          wl_pci_probe,
217         suspend:        wl_suspend,
218 @@ -1579,11 +1578,7 @@
219         }
220  
221         WL_LOCK(wl);
222 -       if (!capable(CAP_NET_ADMIN)) {
223 -               bcmerror = BCME_EPERM;
224 -       } else {
225 -               bcmerror = wlc_ioctl(wl->wlc, ioc.cmd, buf, ioc.len, wlif->wlcif);
226 -       }
227 +       bcmerror = wlc_ioctl(wl->wlc, ioc.cmd, buf, ioc.len, wlif->wlcif);
228         WL_UNLOCK(wl);
229  
230  done1:
231 @@ -2960,7 +2955,7 @@
232  void
233  wl_tkip_printstats(wl_info_t *wl, bool group_key)
234  {
235 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
236 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
237         char debug_buf[512];
238         int idx;
239         if (wl->tkipmodops) {
240 @@ -3120,6 +3115,7 @@
241  }
242  
243  static int
244 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
245  wl_proc_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
246  {
247         wl_info_t * wl = (wl_info_t *)data;
248 @@ -3120,19 +3115,86 @@
249         }
250         return length;
251  }
252 +#else
253 +wl_proc_read(struct seq_file *seq, void *offset)
254 +{
255 +       wl_info_t * wl = (wl_info_t *)seq->private;
256 +       int bcmerror, to_user;
257 +
258 +       WL_LOCK(wl);
259 +       bcmerror = wlc_ioctl(wl->wlc, WLC_GET_MONITOR, &to_user, sizeof(int), NULL);
260 +       WL_UNLOCK(wl);
261 +
262 +       seq_printf(seq, "%d\n", to_user);
263 +       return bcmerror;
264 +}
265 +
266 +static ssize_t wl_proc_write(struct file *file, const char __user *buff,
267 +                            size_t length, loff_t *ppos)
268 +{
269 +       struct seq_file *seq = file->private_data;
270 +       wl_info_t * wl = (wl_info_t *)seq->private;
271 +       int bcmerror, from_user = 0;
272 +
273 +       if (length != 1) {
274 +               WL_ERROR(("%s: Invalid data length\n", __FUNCTION__));
275 +               return -EIO;
276 +       }
277 +
278 +       if (copy_from_user(&from_user, buff, 1)) {
279 +               WL_ERROR(("%s: copy from user failed\n", __FUNCTION__));
280 +               return -EFAULT;
281 +       }
282 +
283 +       if (from_user >= 0x30)
284 +               from_user -= 0x30;
285 +
286 +       WL_LOCK(wl);
287 +       bcmerror = wlc_ioctl(wl->wlc, WLC_SET_MONITOR, &from_user, sizeof(int), NULL);
288 +       WL_UNLOCK(wl);
289 +
290 +       if (bcmerror < 0) {
291 +               WL_ERROR(("%s: SET_MONITOR failed with %d\n", __FUNCTION__, bcmerror));
292 +               return -EIO;
293 +       }
294 +       *ppos += length;
295 +       return length;
296 +}
297 +
298 +static int wl_proc_open(struct inode *inode, struct file *file)
299 +{
300 +       return single_open(file, wl_proc_read, PDE_DATA(inode));
301 +}
302 +
303 +static const struct file_operations wl_proc_fops = {
304 +       .owner = THIS_MODULE,
305 +       .open = wl_proc_open,
306 +       .read = seq_read,
307 +       .write = wl_proc_write,
308 +       .llseek = seq_lseek,
309 +       .release = single_release,
310 +};
311 +#endif
312  
313  static int
314  wl_reg_proc_entry(wl_info_t *wl)
315  {
316         char tmp[32];
317         sprintf(tmp, "%s%d", HYBRID_PROC, wl->pub->unit);
318 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
319         if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
320 +#else
321 +       wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_proc_fops, wl);
322 +       if (!wl->proc_entry) {
323 +#endif
324                 WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp));
325                 ASSERT(0);
326                 return -1;
327         }
328 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
329         wl->proc_entry->read_proc = wl_proc_read;
330         wl->proc_entry->write_proc = wl_proc_write;
331         wl->proc_entry->data = wl;
332 +#endif
333         return 0;
334  }
This page took 0.609672 seconds and 3 git commands to generate.