diff options
author | Luciano Coelho <coelho@ti.com> | 2011-03-21 17:16:14 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-04-19 09:49:12 -0400 |
commit | 4a31c11c7d8c482598754a577a8fb71abb61ffa0 (patch) | |
tree | c43a18ce0e9ee6bc54dc3dcda83b2e6e3ae85438 /drivers/net/wireless/wl12xx/scan.c | |
parent | 4623ec7d97afaf7a8489036e2c2e71e8349716b4 (diff) |
wl12xx: use a bitmask instead of list of booleans in scanned_ch
We were using an array of booleans to mark the channels we had already
scanned. This was causing a sparse error, because bool is not a type
with defined size. To fix this, use bitmasks instead, which is much
cleaner anyway.
Thanks Johannes Berg for the idea.
Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/scan.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/scan.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c index 420653a2859c..5d0544c8f3f5 100644 --- a/drivers/net/wireless/wl12xx/scan.c +++ b/drivers/net/wireless/wl12xx/scan.c | |||
@@ -48,8 +48,7 @@ void wl1271_scan_complete_work(struct work_struct *work) | |||
48 | goto out; | 48 | goto out; |
49 | 49 | ||
50 | wl->scan.state = WL1271_SCAN_STATE_IDLE; | 50 | wl->scan.state = WL1271_SCAN_STATE_IDLE; |
51 | kfree(wl->scan.scanned_ch); | 51 | memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); |
52 | wl->scan.scanned_ch = NULL; | ||
53 | wl->scan.req = NULL; | 52 | wl->scan.req = NULL; |
54 | ieee80211_scan_completed(wl->hw, false); | 53 | ieee80211_scan_completed(wl->hw, false); |
55 | 54 | ||
@@ -87,7 +86,7 @@ static int wl1271_get_scan_channels(struct wl1271 *wl, | |||
87 | 86 | ||
88 | flags = req->channels[i]->flags; | 87 | flags = req->channels[i]->flags; |
89 | 88 | ||
90 | if (!wl->scan.scanned_ch[i] && | 89 | if (!test_bit(i, wl->scan.scanned_ch) && |
91 | !(flags & IEEE80211_CHAN_DISABLED) && | 90 | !(flags & IEEE80211_CHAN_DISABLED) && |
92 | ((!!(flags & IEEE80211_CHAN_PASSIVE_SCAN)) == passive) && | 91 | ((!!(flags & IEEE80211_CHAN_PASSIVE_SCAN)) == passive) && |
93 | (req->channels[i]->band == band)) { | 92 | (req->channels[i]->band == band)) { |
@@ -124,7 +123,7 @@ static int wl1271_get_scan_channels(struct wl1271 *wl, | |||
124 | memset(&channels[j].bssid_msb, 0xff, 2); | 123 | memset(&channels[j].bssid_msb, 0xff, 2); |
125 | 124 | ||
126 | /* Mark the channels we already used */ | 125 | /* Mark the channels we already used */ |
127 | wl->scan.scanned_ch[i] = true; | 126 | set_bit(i, wl->scan.scanned_ch); |
128 | 127 | ||
129 | j++; | 128 | j++; |
130 | } | 129 | } |
@@ -291,6 +290,12 @@ void wl1271_scan_stm(struct wl1271 *wl) | |||
291 | int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, | 290 | int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, |
292 | struct cfg80211_scan_request *req) | 291 | struct cfg80211_scan_request *req) |
293 | { | 292 | { |
293 | /* | ||
294 | * cfg80211 should guarantee that we don't get more channels | ||
295 | * than what we have registered. | ||
296 | */ | ||
297 | BUG_ON(req->n_channels > WL1271_MAX_CHANNELS); | ||
298 | |||
294 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) | 299 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) |
295 | return -EBUSY; | 300 | return -EBUSY; |
296 | 301 | ||
@@ -304,10 +309,8 @@ int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, | |||
304 | } | 309 | } |
305 | 310 | ||
306 | wl->scan.req = req; | 311 | wl->scan.req = req; |
312 | memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); | ||
307 | 313 | ||
308 | wl->scan.scanned_ch = kcalloc(req->n_channels, | ||
309 | sizeof(*wl->scan.scanned_ch), | ||
310 | GFP_KERNEL); | ||
311 | /* we assume failure so that timeout scenarios are handled correctly */ | 314 | /* we assume failure so that timeout scenarios are handled correctly */ |
312 | wl->scan.failed = true; | 315 | wl->scan.failed = true; |
313 | ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, | 316 | ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, |