~ubuntu-branches/ubuntu/precise/bcmwl/precise-proposed

« back to all changes in this revision

Viewing changes to debian/patches/0006-add-support-for-linux-3.8.0.patch

  • Committer: Package Import Robot
  • Author(s): Alberto Milone
  • Date: 2013-09-09 22:07:09 UTC
  • Revision ID: package-import@ubuntu.com-20130909220709-clyzabus1sb8x4kf
Tags: 6.20.155.1+bdcom-0ubuntu0.0.2
* 0006-add-support-for-linux-3.8.0.patch,
  0007-nl80211-move-scan-API-to-wdev.patch,
  0008-add-support-for-linux-3.9.0.patch,
  0009-add-support-for-linux-3.10.0.patch:
  - Add support for kernels up to 3.11 (LP: #1095751).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 3b382faf0a779f376beac577bb015bd0d6d12581 Mon Sep 17 00:00:00 2001
 
2
From: Alberto Milone <alberto.milone@canonical.com>
 
3
Date: Tue, 8 Jan 2013 12:41:52 +0100
 
4
Subject: [PATCH 1/1] Add support for Linux 3.8
 
5
 
 
6
struct cfg80211_bss has changed, therefore we need to access
 
7
the equivalents of the now gone struct members information_elements
 
8
and len_information_elements. In order to do so, we need to
 
9
access struct cfg80211_bss_ies through its pointer using
 
10
rcu_dereference(), after calling rcu_read_lock().
 
11
---
 
12
 src/include/bcmutils.h   |    4 +++
 
13
 src/wl/sys/wl_cfg80211.c |   61 ++++++++++++++++++++++++++++++++++++++++++++--
 
14
 src/wl/sys/wl_linux.c    |    4 +++
 
15
 3 files changed, 67 insertions(+), 2 deletions(-)
 
16
 
 
17
diff --git a/src/include/bcmutils.h b/src/include/bcmutils.h
 
18
index f806b5e..3633328 100644
 
19
--- a/src/include/bcmutils.h
 
20
+++ b/src/include/bcmutils.h
 
21
@@ -214,7 +214,11 @@ typedef struct bcm_tlv {
 
22
 extern int bcm_format_flags(const bcm_bit_desc_t *bd, uint32 flags, char* buf, int len);
 
23
 extern int bcm_format_hex(char *str, const void *bytes, int len);
 
24
 #endif
 
25
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
26
 extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(void *buf, int buflen, uint key);
 
27
+#else
 
28
+extern bcm_tlv_t *BCMROMFN(bcm_parse_tlvs)(const void *buf, int buflen, uint key);
 
29
+#endif
 
30
 
 
31
 typedef uint32 mbool;
 
32
 
 
33
diff --git a/src/wl/sys/wl_cfg80211.c b/src/wl/sys/wl_cfg80211.c
 
34
index 796e3a9..1de1317 100644
 
35
--- a/src/wl/sys/wl_cfg80211.c
 
36
+++ b/src/wl/sys/wl_cfg80211.c
 
37
@@ -61,14 +61,25 @@ static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
 
38
 static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code);
 
39
 
 
40
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
 
41
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
42
 static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
 
43
            enum nl80211_tx_power_setting type, s32 dbm);
 
44
 #else
 
45
+static int wl_cfg80211_set_tx_power(struct wiphy *wiphy,
 
46
+           struct wireless_dev *wdev,
 
47
+           enum nl80211_tx_power_setting type, int dbm);
 
48
+#endif /* 3.8 */
 
49
+#else
 
50
 static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy,
 
51
            enum tx_power_setting type, s32 dbm);
 
52
 #endif
 
53
 
 
54
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
55
 static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm);
 
56
+#else
 
57
+static int wl_cfg80211_get_tx_power(struct wiphy *wiphy,
 
58
+                  struct wireless_dev *wdev, int *dbm);
 
59
+#endif
 
60
 
 
61
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
 
62
 static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
 
63
@@ -702,7 +713,11 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
 
64
        else
 
65
                memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN);
 
66
 
 
67
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
68
        wl_ch_to_chanspec(params->channel, &join_params, &join_params_size);
 
69
+#else
 
70
+       wl_ch_to_chanspec(params->chandef.chan, &join_params, &join_params_size);
 
71
+#endif
 
72
 
 
73
        err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size);
 
74
        if (err) {
 
75
@@ -1057,9 +1072,15 @@ wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_c
 
76
 }
 
77
 
 
78
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
 
79
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
80
 static s32
 
81
 wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum nl80211_tx_power_setting type, s32 dbm)
 
82
 #else
 
83
+static int
 
84
+wl_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
 
85
+                                               enum nl80211_tx_power_setting type, int dbm)
 
86
+#endif /* 3.8 */
 
87
+#else
 
88
 #define NL80211_TX_POWER_AUTOMATIC TX_POWER_AUTOMATIC
 
89
 #define NL80211_TX_POWER_LIMITED TX_POWER_LIMITED
 
90
 #define NL80211_TX_POWER_FIXED TX_POWER_FIXED
 
91
@@ -1110,24 +1131,41 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, s32 db
 
92
        }
 
93
        wl->conf->tx_power = dbm;
 
94
 
 
95
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
96
        return err;
 
97
+#else
 
98
+       return (int) err;
 
99
+#endif
 
100
 }
 
101
 
 
102
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
103
 static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
 
104
+#else
 
105
+static int wl_cfg80211_get_tx_power(struct wiphy *wiphy,
 
106
+                       struct wireless_dev *wdev, int *dbm)
 
107
+#endif
 
108
 {
 
109
        struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
 
110
        struct net_device *ndev = wl_to_ndev(wl);
 
111
        s32 txpwrdbm;
 
112
        u8 result;
 
113
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
114
        s32 err = 0;
 
115
-
 
116
+#else
 
117
+       int err = 0;
 
118
+#endif
 
119
        err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm);
 
120
        if (err) {
 
121
                WL_ERR(("error (%d)\n", err));
 
122
                return err;
 
123
        }
 
124
        result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
 
125
+
 
126
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
127
        *dbm = (s32) bcm_qdbm_to_mw(result);
 
128
+#else
 
129
+       *dbm = (int) bcm_qdbm_to_mw(result);
 
130
+#endif
 
131
 
 
132
        return err;
 
133
 }
 
134
@@ -1957,9 +1995,14 @@ static s32 wl_update_bss_info(struct wl_cfg80211_priv *wl)
 
135
        struct wlc_ssid *ssid;
 
136
        struct bcm_tlv *tim;
 
137
        s32 dtim_period;
 
138
+       s32 err = 0;
 
139
        size_t ie_len;
 
140
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
141
        u8 *ie;
 
142
-       s32 err = 0;
 
143
+#else
 
144
+       const u8 *ie;
 
145
+       const struct cfg80211_bss_ies *ies;
 
146
+#endif
 
147
 
 
148
        ssid = &wl->profile->ssid;
 
149
        bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (s8 *)&wl->bssid,
 
150
@@ -1988,8 +2031,22 @@ static s32 wl_update_bss_info(struct wl_cfg80211_priv *wl)
 
151
                ie_len = bi->ie_length;
 
152
        } else {
 
153
                WL_DBG(("Found the AP in the list - BSSID %pM\n", bss->bssid));
 
154
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
155
                ie = bss->information_elements;
 
156
                ie_len = bss->len_information_elements;
 
157
+#else
 
158
+               rcu_read_lock();
 
159
+               ies = (const struct cfg80211_bss_ies*)rcu_dereference(bss->ies);
 
160
+               if (!ies) {
 
161
+                       /* This should never happen */
 
162
+                       rcu_read_unlock();
 
163
+                       err = -EIO;
 
164
+                       goto update_bss_info_out;
 
165
+               }
 
166
+               ie = ies->data;
 
167
+               ie_len = (size_t)(ies->len);
 
168
+               rcu_read_unlock();
 
169
+#endif
 
170
                cfg80211_put_bss(bss);
 
171
        }
 
172
 
 
173
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
 
174
index f64496b..db54455 100644
 
175
--- a/src/wl/sys/wl_linux.c
 
176
+++ b/src/wl/sys/wl_linux.c
 
177
@@ -735,7 +735,11 @@ wl_remove(struct pci_dev *pdev)
 
178
        pci_set_drvdata(pdev, NULL);
 
179
 }
 
180
 
 
181
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
 
182
 static struct pci_driver wl_pci_driver = {
 
183
+#else
 
184
+static struct pci_driver wl_pci_driver __refdata = {
 
185
+#endif
 
186
        name:           "wl",
 
187
        probe:          wl_pci_probe,
 
188
        suspend:        wl_suspend,
 
189
-- 
 
190
1.7.9.5
 
191