aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1251_main.c
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2009-06-12 07:17:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:50 -0400
commit80301cdcfe44e3533175be23d7d52a9fc8c3fdb0 (patch)
tree624d018b822016a8f83d49588012519a4e9a4d16 /drivers/net/wireless/wl12xx/wl1251_main.c
parent1e6f172fccbf1194bad4b2aeae437ec3189a3f08 (diff)
wl1251: use wl1251 prefix everywhere
Last we can change all code prefixes from wl12xx/WL12XX to wl1251/WL1251. Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1251_main.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_main.c477
1 files changed, 242 insertions, 235 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 41b9c616ee8..f4bc5796c24 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * This file is part of wl12xx 2 * This file is part of wl1251
3 * 3 *
4 * Copyright (C) 2008-2009 Nokia Corporation 4 * Copyright (C) 2008-2009 Nokia Corporation
5 * 5 *
@@ -43,26 +43,26 @@
43#include "wl1251_init.h" 43#include "wl1251_init.h"
44#include "wl1251_debugfs.h" 44#include "wl1251_debugfs.h"
45 45
46static void wl12xx_disable_interrupts(struct wl12xx *wl) 46static void wl1251_disable_interrupts(struct wl1251 *wl)
47{ 47{
48 disable_irq(wl->irq); 48 disable_irq(wl->irq);
49} 49}
50 50
51static void wl12xx_power_off(struct wl12xx *wl) 51static void wl1251_power_off(struct wl1251 *wl)
52{ 52{
53 wl->set_power(false); 53 wl->set_power(false);
54} 54}
55 55
56static void wl12xx_power_on(struct wl12xx *wl) 56static void wl1251_power_on(struct wl1251 *wl)
57{ 57{
58 wl->set_power(true); 58 wl->set_power(true);
59} 59}
60 60
61static irqreturn_t wl12xx_irq(int irq, void *cookie) 61static irqreturn_t wl1251_irq(int irq, void *cookie)
62{ 62{
63 struct wl12xx *wl; 63 struct wl1251 *wl;
64 64
65 wl12xx_debug(DEBUG_IRQ, "IRQ"); 65 wl1251_debug(DEBUG_IRQ, "IRQ");
66 66
67 wl = cookie; 67 wl = cookie;
68 68
@@ -71,7 +71,7 @@ static irqreturn_t wl12xx_irq(int irq, void *cookie)
71 return IRQ_HANDLED; 71 return IRQ_HANDLED;
72} 72}
73 73
74static int wl12xx_fetch_firmware(struct wl12xx *wl) 74static int wl1251_fetch_firmware(struct wl1251 *wl)
75{ 75{
76 const struct firmware *fw; 76 const struct firmware *fw;
77 int ret; 77 int ret;
@@ -79,12 +79,12 @@ static int wl12xx_fetch_firmware(struct wl12xx *wl)
79 ret = request_firmware(&fw, wl->chip.fw_filename, &wl->spi->dev); 79 ret = request_firmware(&fw, wl->chip.fw_filename, &wl->spi->dev);
80 80
81 if (ret < 0) { 81 if (ret < 0) {
82 wl12xx_error("could not get firmware: %d", ret); 82 wl1251_error("could not get firmware: %d", ret);
83 return ret; 83 return ret;
84 } 84 }
85 85
86 if (fw->size % 4) { 86 if (fw->size % 4) {
87 wl12xx_error("firmware size is not multiple of 32 bits: %zu", 87 wl1251_error("firmware size is not multiple of 32 bits: %zu",
88 fw->size); 88 fw->size);
89 ret = -EILSEQ; 89 ret = -EILSEQ;
90 goto out; 90 goto out;
@@ -94,7 +94,7 @@ static int wl12xx_fetch_firmware(struct wl12xx *wl)
94 wl->fw = kmalloc(wl->fw_len, GFP_KERNEL); 94 wl->fw = kmalloc(wl->fw_len, GFP_KERNEL);
95 95
96 if (!wl->fw) { 96 if (!wl->fw) {
97 wl12xx_error("could not allocate memory for the firmware"); 97 wl1251_error("could not allocate memory for the firmware");
98 ret = -ENOMEM; 98 ret = -ENOMEM;
99 goto out; 99 goto out;
100 } 100 }
@@ -109,7 +109,7 @@ out:
109 return ret; 109 return ret;
110} 110}
111 111
112static int wl12xx_fetch_nvs(struct wl12xx *wl) 112static int wl1251_fetch_nvs(struct wl1251 *wl)
113{ 113{
114 const struct firmware *fw; 114 const struct firmware *fw;
115 int ret; 115 int ret;
@@ -117,12 +117,12 @@ static int wl12xx_fetch_nvs(struct wl12xx *wl)
117 ret = request_firmware(&fw, wl->chip.nvs_filename, &wl->spi->dev); 117 ret = request_firmware(&fw, wl->chip.nvs_filename, &wl->spi->dev);
118 118
119 if (ret < 0) { 119 if (ret < 0) {
120 wl12xx_error("could not get nvs file: %d", ret); 120 wl1251_error("could not get nvs file: %d", ret);
121 return ret; 121 return ret;
122 } 122 }
123 123
124 if (fw->size % 4) { 124 if (fw->size % 4) {
125 wl12xx_error("nvs size is not multiple of 32 bits: %zu", 125 wl1251_error("nvs size is not multiple of 32 bits: %zu",
126 fw->size); 126 fw->size);
127 ret = -EILSEQ; 127 ret = -EILSEQ;
128 goto out; 128 goto out;
@@ -132,7 +132,7 @@ static int wl12xx_fetch_nvs(struct wl12xx *wl)
132 wl->nvs = kmalloc(wl->nvs_len, GFP_KERNEL); 132 wl->nvs = kmalloc(wl->nvs_len, GFP_KERNEL);
133 133
134 if (!wl->nvs) { 134 if (!wl->nvs) {
135 wl12xx_error("could not allocate memory for the nvs file"); 135 wl1251_error("could not allocate memory for the nvs file");
136 ret = -ENOMEM; 136 ret = -ENOMEM;
137 goto out; 137 goto out;
138 } 138 }
@@ -147,49 +147,49 @@ out:
147 return ret; 147 return ret;
148} 148}
149 149
150static void wl12xx_fw_wakeup(struct wl12xx *wl) 150static void wl1251_fw_wakeup(struct wl1251 *wl)
151{ 151{
152 u32 elp_reg; 152 u32 elp_reg;
153 153
154 elp_reg = ELPCTRL_WAKE_UP; 154 elp_reg = ELPCTRL_WAKE_UP;
155 wl12xx_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg); 155 wl1251_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg);
156 elp_reg = wl12xx_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR); 156 elp_reg = wl1251_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);
157 157
158 if (!(elp_reg & ELPCTRL_WLAN_READY)) { 158 if (!(elp_reg & ELPCTRL_WLAN_READY)) {
159 wl12xx_warning("WLAN not ready"); 159 wl1251_warning("WLAN not ready");
160 } 160 }
161} 161}
162 162
163static int wl12xx_chip_wakeup(struct wl12xx *wl) 163static int wl1251_chip_wakeup(struct wl1251 *wl)
164{ 164{
165 int ret = 0; 165 int ret = 0;
166 166
167 wl12xx_power_on(wl); 167 wl1251_power_on(wl);
168 msleep(wl->chip.power_on_sleep); 168 msleep(wl->chip.power_on_sleep);
169 wl12xx_spi_reset(wl); 169 wl1251_spi_reset(wl);
170 wl12xx_spi_init(wl); 170 wl1251_spi_init(wl);
171 171
172 /* We don't need a real memory partition here, because we only want 172 /* We don't need a real memory partition here, because we only want
173 * to use the registers at this point. */ 173 * to use the registers at this point. */
174 wl12xx_set_partition(wl, 174 wl1251_set_partition(wl,
175 0x00000000, 175 0x00000000,
176 0x00000000, 176 0x00000000,
177 REGISTERS_BASE, 177 REGISTERS_BASE,
178 REGISTERS_DOWN_SIZE); 178 REGISTERS_DOWN_SIZE);
179 179
180 /* ELP module wake up */ 180 /* ELP module wake up */
181 wl12xx_fw_wakeup(wl); 181 wl1251_fw_wakeup(wl);
182 182
183 /* whal_FwCtrl_BootSm() */ 183 /* whal_FwCtrl_BootSm() */
184 184
185 /* 0. read chip id from CHIP_ID */ 185 /* 0. read chip id from CHIP_ID */
186 wl->chip.id = wl12xx_reg_read32(wl, CHIP_ID_B); 186 wl->chip.id = wl1251_reg_read32(wl, CHIP_ID_B);
187 187
188 /* 1. check if chip id is valid */ 188 /* 1. check if chip id is valid */
189 189
190 switch (wl->chip.id) { 190 switch (wl->chip.id) {
191 case CHIP_ID_1251_PG12: 191 case CHIP_ID_1251_PG12:
192 wl12xx_debug(DEBUG_BOOT, "chip id 0x%x (1251 PG12)", 192 wl1251_debug(DEBUG_BOOT, "chip id 0x%x (1251 PG12)",
193 wl->chip.id); 193 wl->chip.id);
194 194
195 wl1251_setup(wl); 195 wl1251_setup(wl);
@@ -198,20 +198,20 @@ static int wl12xx_chip_wakeup(struct wl12xx *wl)
198 case CHIP_ID_1251_PG10: 198 case CHIP_ID_1251_PG10:
199 case CHIP_ID_1251_PG11: 199 case CHIP_ID_1251_PG11:
200 default: 200 default:
201 wl12xx_error("unsupported chip id: 0x%x", wl->chip.id); 201 wl1251_error("unsupported chip id: 0x%x", wl->chip.id);
202 ret = -ENODEV; 202 ret = -ENODEV;
203 goto out; 203 goto out;
204 } 204 }
205 205
206 if (wl->fw == NULL) { 206 if (wl->fw == NULL) {
207 ret = wl12xx_fetch_firmware(wl); 207 ret = wl1251_fetch_firmware(wl);
208 if (ret < 0) 208 if (ret < 0)
209 goto out; 209 goto out;
210 } 210 }
211 211
212 /* No NVS from netlink, try to get it from the filesystem */ 212 /* No NVS from netlink, try to get it from the filesystem */
213 if (wl->nvs == NULL) { 213 if (wl->nvs == NULL) {
214 ret = wl12xx_fetch_nvs(wl); 214 ret = wl1251_fetch_nvs(wl);
215 if (ret < 0) 215 if (ret < 0)
216 goto out; 216 goto out;
217 } 217 }
@@ -220,18 +220,18 @@ out:
220 return ret; 220 return ret;
221} 221}
222 222
223static void wl12xx_filter_work(struct work_struct *work) 223static void wl1251_filter_work(struct work_struct *work)
224{ 224{
225 struct wl12xx *wl = 225 struct wl1251 *wl =
226 container_of(work, struct wl12xx, filter_work); 226 container_of(work, struct wl1251, filter_work);
227 int ret; 227 int ret;
228 228
229 mutex_lock(&wl->mutex); 229 mutex_lock(&wl->mutex);
230 230
231 if (wl->state == WL12XX_STATE_OFF) 231 if (wl->state == WL1251_STATE_OFF)
232 goto out; 232 goto out;
233 233
234 ret = wl12xx_ps_elp_wakeup(wl); 234 ret = wl1251_ps_elp_wakeup(wl);
235 if (ret < 0) 235 if (ret < 0)
236 goto out; 236 goto out;
237 237
@@ -241,27 +241,29 @@ static void wl12xx_filter_work(struct work_struct *work)
241 goto out_sleep; 241 goto out_sleep;
242 242
243out_sleep: 243out_sleep:
244 wl12xx_ps_elp_sleep(wl); 244 wl1251_ps_elp_sleep(wl);
245 245
246out: 246out:
247 mutex_unlock(&wl->mutex); 247 mutex_unlock(&wl->mutex);
248} 248}
249 249
250int wl12xx_plt_start(struct wl12xx *wl) 250int wl1251_plt_start(struct wl1251 *wl)
251{ 251{
252 int ret; 252 int ret;
253 253
254 wl12xx_notice("power up"); 254 mutex_lock(&wl->mutex);
255
256 wl1251_notice("power up");
255 257
256 if (wl->state != WL12XX_STATE_OFF) { 258 if (wl->state != WL1251_STATE_OFF) {
257 wl12xx_error("cannot go into PLT state because not " 259 wl1251_error("cannot go into PLT state because not "
258 "in off state: %d", wl->state); 260 "in off state: %d", wl->state);
259 return -EBUSY; 261 return -EBUSY;
260 } 262 }
261 263
262 wl->state = WL12XX_STATE_PLT; 264 wl->state = WL1251_STATE_PLT;
263 265
264 ret = wl12xx_chip_wakeup(wl); 266 ret = wl1251_chip_wakeup(wl);
265 if (ret < 0) 267 if (ret < 0)
266 return ret; 268 return ret;
267 269
@@ -269,7 +271,7 @@ int wl12xx_plt_start(struct wl12xx *wl)
269 if (ret < 0) 271 if (ret < 0)
270 return ret; 272 return ret;
271 273
272 wl12xx_notice("firmware booted in PLT mode (%s)", wl->chip.fw_ver); 274 wl1251_notice("firmware booted in PLT mode (%s)", wl->chip.fw_ver);
273 275
274 ret = wl->chip.op_plt_init(wl); 276 ret = wl->chip.op_plt_init(wl);
275 if (ret < 0) 277 if (ret < 0)
@@ -278,28 +280,30 @@ int wl12xx_plt_start(struct wl12xx *wl)
278 return 0; 280 return 0;
279} 281}
280 282
281int wl12xx_plt_stop(struct wl12xx *wl) 283int wl1251_plt_stop(struct wl1251 *wl)
282{ 284{
283 wl12xx_notice("power down"); 285 mutex_lock(&wl->mutex);
286
287 wl1251_notice("power down");
284 288
285 if (wl->state != WL12XX_STATE_PLT) { 289 if (wl->state != WL1251_STATE_PLT) {
286 wl12xx_error("cannot power down because not in PLT " 290 wl1251_error("cannot power down because not in PLT "
287 "state: %d", wl->state); 291 "state: %d", wl->state);
288 return -EBUSY; 292 return -EBUSY;
289 } 293 }
290 294
291 wl12xx_disable_interrupts(wl); 295 wl1251_disable_interrupts(wl);
292 wl12xx_power_off(wl); 296 wl1251_power_off(wl);
293 297
294 wl->state = WL12XX_STATE_OFF; 298 wl->state = WL1251_STATE_OFF;
295 299
296 return 0; 300 return 0;
297} 301}
298 302
299 303
300static int wl12xx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 304static int wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
301{ 305{
302 struct wl12xx *wl = hw->priv; 306 struct wl1251 *wl = hw->priv;
303 307
304 skb_queue_tail(&wl->tx_queue, skb); 308 skb_queue_tail(&wl->tx_queue, skb);
305 309
@@ -314,7 +318,7 @@ static int wl12xx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
314 * The workqueue is slow to process the tx_queue and we need stop 318 * The workqueue is slow to process the tx_queue and we need stop
315 * the queue here, otherwise the queue will get too long. 319 * the queue here, otherwise the queue will get too long.
316 */ 320 */
317 if (skb_queue_len(&wl->tx_queue) >= WL12XX_TX_QUEUE_MAX_LENGTH) { 321 if (skb_queue_len(&wl->tx_queue) >= WL1251_TX_QUEUE_MAX_LENGTH) {
318 ieee80211_stop_queues(wl->hw); 322 ieee80211_stop_queues(wl->hw);
319 323
320 /* 324 /*
@@ -328,23 +332,23 @@ static int wl12xx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
328 return NETDEV_TX_OK; 332 return NETDEV_TX_OK;
329} 333}
330 334
331static int wl12xx_op_start(struct ieee80211_hw *hw) 335static int wl1251_op_start(struct ieee80211_hw *hw)
332{ 336{
333 struct wl12xx *wl = hw->priv; 337 struct wl1251 *wl = hw->priv;
334 int ret = 0; 338 int ret = 0;
335 339
336 wl12xx_debug(DEBUG_MAC80211, "mac80211 start"); 340 wl1251_debug(DEBUG_MAC80211, "mac80211 start");
337 341
338 mutex_lock(&wl->mutex); 342 mutex_lock(&wl->mutex);
339 343
340 if (wl->state != WL12XX_STATE_OFF) { 344 if (wl->state != WL1251_STATE_OFF) {
341 wl12xx_error("cannot start because not in off state: %d", 345 wl1251_error("cannot start because not in off state: %d",
342 wl->state); 346 wl->state);
343 ret = -EBUSY; 347 ret = -EBUSY;
344 goto out; 348 goto out;
345 } 349 }
346 350
347 ret = wl12xx_chip_wakeup(wl); 351 ret = wl1251_chip_wakeup(wl);
348 if (ret < 0) 352 if (ret < 0)
349 return ret; 353 return ret;
350 354
@@ -356,34 +360,34 @@ static int wl12xx_op_start(struct ieee80211_hw *hw)
356 if (ret < 0) 360 if (ret < 0)
357 goto out; 361 goto out;
358 362
359 ret = wl12xx_acx_station_id(wl); 363 ret = wl1251_acx_station_id(wl);
360 if (ret < 0) 364 if (ret < 0)
361 goto out; 365 goto out;
362 366
363 wl->state = WL12XX_STATE_ON; 367 wl->state = WL1251_STATE_ON;
364 368
365 wl12xx_info("firmware booted (%s)", wl->chip.fw_ver); 369 wl1251_info("firmware booted (%s)", wl->chip.fw_ver);
366 370
367out: 371out:
368 if (ret < 0) 372 if (ret < 0)
369 wl12xx_power_off(wl); 373 wl1251_power_off(wl);
370 374
371 mutex_unlock(&wl->mutex); 375 mutex_unlock(&wl->mutex);
372 376
373 return ret; 377 return ret;
374} 378}
375 379
376static void wl12xx_op_stop(struct ieee80211_hw *hw) 380static void wl1251_op_stop(struct ieee80211_hw *hw)
377{ 381{
378 struct wl12xx *wl = hw->priv; 382 struct wl1251 *wl = hw->priv;
379 383
380 wl12xx_info("down"); 384 wl1251_info("down");
381 385
382 wl12xx_debug(DEBUG_MAC80211, "mac80211 stop"); 386 wl1251_debug(DEBUG_MAC80211, "mac80211 stop");
383 387
384 mutex_lock(&wl->mutex); 388 mutex_lock(&wl->mutex);
385 389
386 WARN_ON(wl->state != WL12XX_STATE_ON); 390 WARN_ON(wl->state != WL1251_STATE_ON);
387 391
388 if (wl->scanning) { 392 if (wl->scanning) {
389 mutex_unlock(&wl->mutex); 393 mutex_unlock(&wl->mutex);
@@ -392,9 +396,9 @@ static void wl12xx_op_stop(struct ieee80211_hw *hw)
392 wl->scanning = false; 396 wl->scanning = false;
393 } 397 }
394 398
395 wl->state = WL12XX_STATE_OFF; 399 wl->state = WL1251_STATE_OFF;
396 400
397 wl12xx_disable_interrupts(wl); 401 wl1251_disable_interrupts(wl);
398 402
399 mutex_unlock(&wl->mutex); 403 mutex_unlock(&wl->mutex);
400 404
@@ -406,7 +410,7 @@ static void wl12xx_op_stop(struct ieee80211_hw *hw)
406 410
407 /* let's notify MAC80211 about the remaining pending TX frames */ 411 /* let's notify MAC80211 about the remaining pending TX frames */
408 wl->chip.op_tx_flush(wl); 412 wl->chip.op_tx_flush(wl);
409 wl12xx_power_off(wl); 413 wl1251_power_off(wl);
410 414
411 memset(wl->bssid, 0, ETH_ALEN); 415 memset(wl->bssid, 0, ETH_ALEN);
412 wl->listen_int = 1; 416 wl->listen_int = 1;
@@ -421,21 +425,21 @@ static void wl12xx_op_stop(struct ieee80211_hw *hw)
421 wl->elp = false; 425 wl->elp = false;
422 wl->psm = 0; 426 wl->psm = 0;
423 wl->tx_queue_stopped = false; 427 wl->tx_queue_stopped = false;
424 wl->power_level = WL12XX_DEFAULT_POWER_LEVEL; 428 wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
425 429
426 wl12xx_debugfs_reset(wl); 430 wl1251_debugfs_reset(wl);
427 431
428 mutex_unlock(&wl->mutex); 432 mutex_unlock(&wl->mutex);
429} 433}
430 434
431static int wl12xx_op_add_interface(struct ieee80211_hw *hw, 435static int wl1251_op_add_interface(struct ieee80211_hw *hw,
432 struct ieee80211_if_init_conf *conf) 436 struct ieee80211_if_init_conf *conf)
433{ 437{
434 struct wl12xx *wl = hw->priv; 438 struct wl1251 *wl = hw->priv;
435 DECLARE_MAC_BUF(mac); 439 DECLARE_MAC_BUF(mac);
436 int ret = 0; 440 int ret = 0;
437 441
438 wl12xx_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %s", 442 wl1251_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %s",
439 conf->type, print_mac(mac, conf->mac_addr)); 443 conf->type, print_mac(mac, conf->mac_addr));
440 444
441 mutex_lock(&wl->mutex); 445 mutex_lock(&wl->mutex);
@@ -455,7 +459,7 @@ static int wl12xx_op_add_interface(struct ieee80211_hw *hw,
455 if (memcmp(wl->mac_addr, conf->mac_addr, ETH_ALEN)) { 459 if (memcmp(wl->mac_addr, conf->mac_addr, ETH_ALEN)) {
456 memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); 460 memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN);
457 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); 461 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr);
458 ret = wl12xx_acx_station_id(wl); 462 ret = wl1251_acx_station_id(wl);
459 if (ret < 0) 463 if (ret < 0)
460 goto out; 464 goto out;
461 } 465 }
@@ -465,13 +469,13 @@ out:
465 return ret; 469 return ret;
466} 470}
467 471
468static void wl12xx_op_remove_interface(struct ieee80211_hw *hw, 472static void wl1251_op_remove_interface(struct ieee80211_hw *hw,
469 struct ieee80211_if_init_conf *conf) 473 struct ieee80211_if_init_conf *conf)
470{ 474{
471 wl12xx_debug(DEBUG_MAC80211, "mac80211 remove interface"); 475 wl1251_debug(DEBUG_MAC80211, "mac80211 remove interface");
472} 476}
473 477
474static int wl12xx_build_null_data(struct wl12xx *wl) 478static int wl1251_build_null_data(struct wl1251 *wl)
475{ 479{
476 struct wl12xx_null_data_template template; 480 struct wl12xx_null_data_template template;
477 481
@@ -487,12 +491,12 @@ static int wl12xx_build_null_data(struct wl12xx *wl)
487 template.header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | 491 template.header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
488 IEEE80211_STYPE_NULLFUNC); 492 IEEE80211_STYPE_NULLFUNC);
489 493
490 return wl12xx_cmd_template_set(wl, CMD_NULL_DATA, &template, 494 return wl1251_cmd_template_set(wl, CMD_NULL_DATA, &template,
491 sizeof(template)); 495 sizeof(template));
492 496
493} 497}
494 498
495static int wl12xx_build_ps_poll(struct wl12xx *wl, u16 aid) 499static int wl1251_build_ps_poll(struct wl1251 *wl, u16 aid)
496{ 500{
497 struct wl12xx_ps_poll_template template; 501 struct wl12xx_ps_poll_template template;
498 502
@@ -501,27 +505,27 @@ static int wl12xx_build_ps_poll(struct wl12xx *wl, u16 aid)
501 template.aid = aid; 505 template.aid = aid;
502 template.fc = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); 506 template.fc = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
503 507
504 return wl12xx_cmd_template_set(wl, CMD_PS_POLL, &template, 508 return wl1251_cmd_template_set(wl, CMD_PS_POLL, &template,
505 sizeof(template)); 509 sizeof(template));
506 510
507} 511}
508 512
509static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed) 513static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
510{ 514{
511 struct wl12xx *wl = hw->priv; 515 struct wl1251 *wl = hw->priv;
512 struct ieee80211_conf *conf = &hw->conf; 516 struct ieee80211_conf *conf = &hw->conf;
513 int channel, ret = 0; 517 int channel, ret = 0;
514 518
515 channel = ieee80211_frequency_to_channel(conf->channel->center_freq); 519 channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
516 520
517 wl12xx_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d", 521 wl1251_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d",
518 channel, 522 channel,
519 conf->flags & IEEE80211_CONF_PS ? "on" : "off", 523 conf->flags & IEEE80211_CONF_PS ? "on" : "off",
520 conf->power_level); 524 conf->power_level);
521 525
522 mutex_lock(&wl->mutex); 526 mutex_lock(&wl->mutex);
523 527
524 ret = wl12xx_ps_elp_wakeup(wl); 528 ret = wl1251_ps_elp_wakeup(wl);
525 if (ret < 0) 529 if (ret < 0)
526 goto out; 530 goto out;
527 531
@@ -534,12 +538,12 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
534 wl->channel = channel; 538 wl->channel = channel;
535 } 539 }
536 540
537 ret = wl12xx_build_null_data(wl); 541 ret = wl1251_build_null_data(wl);
538 if (ret < 0) 542 if (ret < 0)
539 goto out_sleep; 543 goto out_sleep;
540 544
541 if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) { 545 if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) {
542 wl12xx_info("psm enabled"); 546 wl1251_info("psm enabled");
543 547
544 wl->psm_requested = true; 548 wl->psm_requested = true;
545 549
@@ -548,19 +552,19 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
548 * If we're not, we'll enter it when joining an SSID, 552 * If we're not, we'll enter it when joining an SSID,
549 * through the bss_info_changed() hook. 553 * through the bss_info_changed() hook.
550 */ 554 */
551 ret = wl12xx_ps_set_mode(wl, STATION_POWER_SAVE_MODE); 555 ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
552 } else if (!(conf->flags & IEEE80211_CONF_PS) && 556 } else if (!(conf->flags & IEEE80211_CONF_PS) &&
553 wl->psm_requested) { 557 wl->psm_requested) {
554 wl12xx_info("psm disabled"); 558 wl1251_info("psm disabled");
555 559
556 wl->psm_requested = false; 560 wl->psm_requested = false;
557 561
558 if (wl->psm) 562 if (wl->psm)
559 ret = wl12xx_ps_set_mode(wl, STATION_ACTIVE_MODE); 563 ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE);
560 } 564 }
561 565
562 if (conf->power_level != wl->power_level) { 566 if (conf->power_level != wl->power_level) {
563 ret = wl12xx_acx_tx_power(wl, conf->power_level); 567 ret = wl1251_acx_tx_power(wl, conf->power_level);
564 if (ret < 0) 568 if (ret < 0)
565 goto out; 569 goto out;
566 570
@@ -568,7 +572,7 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
568 } 572 }
569 573
570out_sleep: 574out_sleep:
571 wl12xx_ps_elp_sleep(wl); 575 wl1251_ps_elp_sleep(wl);
572 576
573out: 577out:
574 mutex_unlock(&wl->mutex); 578 mutex_unlock(&wl->mutex);
@@ -576,25 +580,25 @@ out:
576 return ret; 580 return ret;
577} 581}
578 582
579#define WL12XX_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \ 583#define WL1251_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \
580 FIF_ALLMULTI | \ 584 FIF_ALLMULTI | \
581 FIF_FCSFAIL | \ 585 FIF_FCSFAIL | \
582 FIF_BCN_PRBRESP_PROMISC | \ 586 FIF_BCN_PRBRESP_PROMISC | \
583 FIF_CONTROL | \ 587 FIF_CONTROL | \
584 FIF_OTHER_BSS) 588 FIF_OTHER_BSS)
585 589
586static void wl12xx_op_configure_filter(struct ieee80211_hw *hw, 590static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
587 unsigned int changed, 591 unsigned int changed,
588 unsigned int *total, 592 unsigned int *total,
589 int mc_count, 593 int mc_count,
590 struct dev_addr_list *mc_list) 594 struct dev_addr_list *mc_list)
591{ 595{
592 struct wl12xx *wl = hw->priv; 596 struct wl1251 *wl = hw->priv;
593 597
594 wl12xx_debug(DEBUG_MAC80211, "mac80211 configure filter"); 598 wl1251_debug(DEBUG_MAC80211, "mac80211 configure filter");
595 599
596 *total &= WL12XX_SUPPORTED_FILTERS; 600 *total &= WL1251_SUPPORTED_FILTERS;
597 changed &= WL12XX_SUPPORTED_FILTERS; 601 changed &= WL1251_SUPPORTED_FILTERS;
598 602
599 if (changed == 0) 603 if (changed == 0)
600 /* no filters which we support changed */ 604 /* no filters which we support changed */
@@ -602,8 +606,8 @@ static void wl12xx_op_configure_filter(struct ieee80211_hw *hw,
602 606
603 /* FIXME: wl->rx_config and wl->rx_filter are not protected */ 607 /* FIXME: wl->rx_config and wl->rx_filter are not protected */
604 608
605 wl->rx_config = WL12XX_DEFAULT_RX_CONFIG; 609 wl->rx_config = WL1251_DEFAULT_RX_CONFIG;
606 wl->rx_filter = WL12XX_DEFAULT_RX_FILTER; 610 wl->rx_filter = WL1251_DEFAULT_RX_FILTER;
607 611
608 if (*total & FIF_PROMISC_IN_BSS) { 612 if (*total & FIF_PROMISC_IN_BSS) {
609 wl->rx_config |= CFG_BSSID_FILTER_EN; 613 wl->rx_config |= CFG_BSSID_FILTER_EN;
@@ -635,8 +639,8 @@ static void wl12xx_op_configure_filter(struct ieee80211_hw *hw,
635} 639}
636 640
637/* HW encryption */ 641/* HW encryption */
638static int wl12xx_set_key_type(struct wl12xx *wl, 642static int wl1251_set_key_type(struct wl1251 *wl,
639 struct wl12xx_cmd_set_keys *key, 643 struct wl1251_cmd_set_keys *key,
640 enum set_key_cmd cmd, 644 enum set_key_cmd cmd,
641 struct ieee80211_key_conf *mac80211_key, 645 struct ieee80211_key_conf *mac80211_key,
642 const u8 *addr) 646 const u8 *addr)
@@ -666,27 +670,27 @@ static int wl12xx_set_key_type(struct wl12xx *wl,
666 mac80211_key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 670 mac80211_key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
667 break; 671 break;
668 default: 672 default:
669 wl12xx_error("Unknown key algo 0x%x", mac80211_key->alg); 673 wl1251_error("Unknown key algo 0x%x", mac80211_key->alg);
670 return -EOPNOTSUPP; 674 return -EOPNOTSUPP;
671 } 675 }
672 676
673 return 0; 677 return 0;
674} 678}
675 679
676static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 680static int wl1251_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
677 struct ieee80211_vif *vif, 681 struct ieee80211_vif *vif,
678 struct ieee80211_sta *sta, 682 struct ieee80211_sta *sta,
679 struct ieee80211_key_conf *key) 683 struct ieee80211_key_conf *key)
680{ 684{
681 struct wl12xx *wl = hw->priv; 685 struct wl1251 *wl = hw->priv;
682 struct wl12xx_cmd_set_keys *wl_cmd; 686 struct wl1251_cmd_set_keys *wl_cmd;
683 const u8 *addr; 687 const u8 *addr;
684 int ret; 688 int ret;
685 689
686 static const u8 bcast_addr[ETH_ALEN] = 690 static const u8 bcast_addr[ETH_ALEN] =
687 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 691 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
688 692
689 wl12xx_debug(DEBUG_MAC80211, "mac80211 set key"); 693 wl1251_debug(DEBUG_MAC80211, "mac80211 set key");
690 694
691 wl_cmd = kzalloc(sizeof(*wl_cmd), GFP_KERNEL); 695 wl_cmd = kzalloc(sizeof(*wl_cmd), GFP_KERNEL);
692 if (!wl_cmd) { 696 if (!wl_cmd) {
@@ -696,11 +700,11 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
696 700
697 addr = sta ? sta->addr : bcast_addr; 701 addr = sta ? sta->addr : bcast_addr;
698 702
699 wl12xx_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd); 703 wl1251_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd);
700 wl12xx_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN); 704 wl1251_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN);
701 wl12xx_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x", 705 wl1251_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x",
702 key->alg, key->keyidx, key->keylen, key->flags); 706 key->alg, key->keyidx, key->keylen, key->flags);
703 wl12xx_dump(DEBUG_CRYPT, "KEY: ", key->key, key->keylen); 707 wl1251_dump(DEBUG_CRYPT, "KEY: ", key->key, key->keylen);
704 708
705 if (is_zero_ether_addr(addr)) { 709 if (is_zero_ether_addr(addr)) {
706 /* We dont support TX only encryption */ 710 /* We dont support TX only encryption */
@@ -710,7 +714,7 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
710 714
711 mutex_lock(&wl->mutex); 715 mutex_lock(&wl->mutex);
712 716
713 ret = wl12xx_ps_elp_wakeup(wl); 717 ret = wl1251_ps_elp_wakeup(wl);
714 if (ret < 0) 718 if (ret < 0)
715 goto out_unlock; 719 goto out_unlock;
716 720
@@ -722,13 +726,13 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
722 wl_cmd->key_action = KEY_REMOVE; 726 wl_cmd->key_action = KEY_REMOVE;
723 break; 727 break;
724 default: 728 default:
725 wl12xx_error("Unsupported key cmd 0x%x", cmd); 729 wl1251_error("Unsupported key cmd 0x%x", cmd);
726 break; 730 break;
727 } 731 }
728 732
729 ret = wl12xx_set_key_type(wl, wl_cmd, cmd, key, addr); 733 ret = wl1251_set_key_type(wl, wl_cmd, cmd, key, addr);
730 if (ret < 0) { 734 if (ret < 0) {
731 wl12xx_error("Set KEY type failed"); 735 wl1251_error("Set KEY type failed");
732 goto out_sleep; 736 goto out_sleep;
733 } 737 }
734 738
@@ -755,16 +759,16 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
755 wl_cmd->id = key->keyidx; 759 wl_cmd->id = key->keyidx;
756 wl_cmd->ssid_profile = 0; 760 wl_cmd->ssid_profile = 0;
757 761
758 wl12xx_dump(DEBUG_CRYPT, "TARGET KEY: ", wl_cmd, sizeof(*wl_cmd)); 762 wl1251_dump(DEBUG_CRYPT, "TARGET KEY: ", wl_cmd, sizeof(*wl_cmd));
759 763
760 ret = wl12xx_cmd_send(wl, CMD_SET_KEYS, wl_cmd, sizeof(*wl_cmd)); 764 ret = wl1251_cmd_send(wl, CMD_SET_KEYS, wl_cmd, sizeof(*wl_cmd));
761 if (ret < 0) { 765 if (ret < 0) {
762 wl12xx_warning("could not set keys"); 766 wl1251_warning("could not set keys");
763 goto out_sleep; 767 goto out_sleep;
764 } 768 }
765 769
766out_sleep: 770out_sleep:
767 wl12xx_ps_elp_sleep(wl); 771 wl1251_ps_elp_sleep(wl);
768 772
769out_unlock: 773out_unlock:
770 mutex_unlock(&wl->mutex); 774 mutex_unlock(&wl->mutex);
@@ -775,7 +779,7 @@ out:
775 return ret; 779 return ret;
776} 780}
777 781
778static int wl12xx_build_basic_rates(char *rates) 782static int wl1251_build_basic_rates(char *rates)
779{ 783{
780 u8 index = 0; 784 u8 index = 0;
781 785
@@ -787,7 +791,7 @@ static int wl12xx_build_basic_rates(char *rates)
787 return index; 791 return index;
788} 792}
789 793
790static int wl12xx_build_extended_rates(char *rates) 794static int wl1251_build_extended_rates(char *rates)
791{ 795{
792 u8 index = 0; 796 u8 index = 0;
793 797
@@ -804,7 +808,7 @@ static int wl12xx_build_extended_rates(char *rates)
804} 808}
805 809
806 810
807static int wl12xx_build_probe_req(struct wl12xx *wl, u8 *ssid, size_t ssid_len) 811static int wl1251_build_probe_req(struct wl1251 *wl, u8 *ssid, size_t ssid_len)
808{ 812{
809 struct wl12xx_probe_req_template template; 813 struct wl12xx_probe_req_template template;
810 struct wl12xx_ie_rates *rates; 814 struct wl12xx_ie_rates *rates;
@@ -831,27 +835,27 @@ static int wl12xx_build_probe_req(struct wl12xx *wl, u8 *ssid, size_t ssid_len)
831 /* Basic Rates */ 835 /* Basic Rates */
832 rates = (struct wl12xx_ie_rates *)ptr; 836 rates = (struct wl12xx_ie_rates *)ptr;
833 rates->header.id = WLAN_EID_SUPP_RATES; 837 rates->header.id = WLAN_EID_SUPP_RATES;
834 rates->header.len = wl12xx_build_basic_rates(rates->rates); 838 rates->header.len = wl1251_build_basic_rates(rates->rates);
835 size += sizeof(struct wl12xx_ie_header) + rates->header.len; 839 size += sizeof(struct wl12xx_ie_header) + rates->header.len;
836 ptr += sizeof(struct wl12xx_ie_header) + rates->header.len; 840 ptr += sizeof(struct wl12xx_ie_header) + rates->header.len;
837 841
838 /* Extended rates */ 842 /* Extended rates */
839 rates = (struct wl12xx_ie_rates *)ptr; 843 rates = (struct wl12xx_ie_rates *)ptr;
840 rates->header.id = WLAN_EID_EXT_SUPP_RATES; 844 rates->header.id = WLAN_EID_EXT_SUPP_RATES;
841 rates->header.len = wl12xx_build_extended_rates(rates->rates); 845 rates->header.len = wl1251_build_extended_rates(rates->rates);
842 size += sizeof(struct wl12xx_ie_header) + rates->header.len; 846 size += sizeof(struct wl12xx_ie_header) + rates->header.len;
843 847
844 wl12xx_dump(DEBUG_SCAN, "PROBE REQ: ", &template, size); 848 wl1251_dump(DEBUG_SCAN, "PROBE REQ: ", &template, size);
845 849
846 return wl12xx_cmd_template_set(wl, CMD_PROBE_REQ, &template, 850 return wl1251_cmd_template_set(wl, CMD_PROBE_REQ, &template,
847 size); 851 size);
848} 852}
849 853
850static int wl12xx_hw_scan(struct wl12xx *wl, u8 *ssid, size_t len, 854static int wl1251_hw_scan(struct wl1251 *wl, u8 *ssid, size_t len,
851 u8 active_scan, u8 high_prio, u8 num_channels, 855 u8 active_scan, u8 high_prio, u8 num_channels,
852 u8 probe_requests) 856 u8 probe_requests)
853{ 857{
854 struct wl12xx_cmd_trigger_scan_to *trigger = NULL; 858 struct wl1251_cmd_trigger_scan_to *trigger = NULL;
855 struct cmd_scan *params = NULL; 859 struct cmd_scan *params = NULL;
856 int i, ret; 860 int i, ret;
857 u16 scan_options = 0; 861 u16 scan_options = 0;
@@ -902,9 +906,9 @@ static int wl12xx_hw_scan(struct wl12xx *wl, u8 *ssid, size_t len,
902 memset(params->params.ssid, 0, 32); 906 memset(params->params.ssid, 0, 32);
903 } 907 }
904 908
905 ret = wl12xx_build_probe_req(wl, ssid, len); 909 ret = wl1251_build_probe_req(wl, ssid, len);
906 if (ret < 0) { 910 if (ret < 0) {
907 wl12xx_error("PROBE request template failed"); 911 wl1251_error("PROBE request template failed");
908 goto out; 912 goto out;
909 } 913 }
910 914
@@ -914,25 +918,25 @@ static int wl12xx_hw_scan(struct wl12xx *wl, u8 *ssid, size_t len,
914 918
915 trigger->timeout = 0; 919 trigger->timeout = 0;
916 920
917 ret = wl12xx_cmd_send(wl, CMD_TRIGGER_SCAN_TO, trigger, 921 ret = wl1251_cmd_send(wl, CMD_TRIGGER_SCAN_TO, trigger,
918 sizeof(*trigger)); 922 sizeof(*trigger));
919 if (ret < 0) { 923 if (ret < 0) {
920 wl12xx_error("trigger scan to failed for hw scan"); 924 wl1251_error("trigger scan to failed for hw scan");
921 goto out; 925 goto out;
922 } 926 }
923 927
924 wl12xx_dump(DEBUG_SCAN, "SCAN: ", params, sizeof(*params)); 928 wl1251_dump(DEBUG_SCAN, "SCAN: ", params, sizeof(*params));
925 929
926 wl->scanning = true; 930 wl->scanning = true;
927 931
928 ret = wl12xx_cmd_send(wl, CMD_SCAN, params, sizeof(*params)); 932 ret = wl1251_cmd_send(wl, CMD_SCAN, params, sizeof(*params));
929 if (ret < 0) 933 if (ret < 0)
930 wl12xx_error("SCAN failed"); 934 wl1251_error("SCAN failed");
931 935
932 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, params, sizeof(*params)); 936 wl1251_spi_mem_read(wl, wl->cmd_box_addr, params, sizeof(*params));
933 937
934 if (params->header.status != CMD_STATUS_SUCCESS) { 938 if (params->header.status != CMD_STATUS_SUCCESS) {
935 wl12xx_error("TEST command answer error: %d", 939 wl1251_error("TEST command answer error: %d",
936 params->header.status); 940 params->header.status);
937 wl->scanning = false; 941 wl->scanning = false;
938 ret = -EIO; 942 ret = -EIO;
@@ -945,15 +949,15 @@ out:
945 949
946} 950}
947 951
948static int wl12xx_op_hw_scan(struct ieee80211_hw *hw, 952static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
949 struct cfg80211_scan_request *req) 953 struct cfg80211_scan_request *req)
950{ 954{
951 struct wl12xx *wl = hw->priv; 955 struct wl1251 *wl = hw->priv;
952 int ret; 956 int ret;
953 u8 *ssid = NULL; 957 u8 *ssid = NULL;
954 size_t ssid_len = 0; 958 size_t ssid_len = 0;
955 959
956 wl12xx_debug(DEBUG_MAC80211, "mac80211 hw scan"); 960 wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan");
957 961
958 if (req->n_ssids) { 962 if (req->n_ssids) {
959 ssid = req->ssids[0].ssid; 963 ssid = req->ssids[0].ssid;
@@ -962,13 +966,13 @@ static int wl12xx_op_hw_scan(struct ieee80211_hw *hw,
962 966
963 mutex_lock(&wl->mutex); 967 mutex_lock(&wl->mutex);
964 968
965 ret = wl12xx_ps_elp_wakeup(wl); 969 ret = wl1251_ps_elp_wakeup(wl);
966 if (ret < 0) 970 if (ret < 0)
967 goto out; 971 goto out;
968 972
969 ret = wl12xx_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3); 973 ret = wl1251_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3);
970 974
971 wl12xx_ps_elp_sleep(wl); 975 wl1251_ps_elp_sleep(wl);
972 976
973out: 977out:
974 mutex_unlock(&wl->mutex); 978 mutex_unlock(&wl->mutex);
@@ -976,22 +980,22 @@ out:
976 return ret; 980 return ret;
977} 981}
978 982
979static int wl12xx_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) 983static int wl1251_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
980{ 984{
981 struct wl12xx *wl = hw->priv; 985 struct wl1251 *wl = hw->priv;
982 int ret; 986 int ret;
983 987
984 mutex_lock(&wl->mutex); 988 mutex_lock(&wl->mutex);
985 989
986 ret = wl12xx_ps_elp_wakeup(wl); 990 ret = wl1251_ps_elp_wakeup(wl);
987 if (ret < 0) 991 if (ret < 0)
988 goto out; 992 goto out;
989 993
990 ret = wl12xx_acx_rts_threshold(wl, (u16) value); 994 ret = wl1251_acx_rts_threshold(wl, (u16) value);
991 if (ret < 0) 995 if (ret < 0)
992 wl12xx_warning("wl12xx_op_set_rts_threshold failed: %d", ret); 996 wl1251_warning("wl1251_op_set_rts_threshold failed: %d", ret);
993 997
994 wl12xx_ps_elp_sleep(wl); 998 wl1251_ps_elp_sleep(wl);
995 999
996out: 1000out:
997 mutex_unlock(&wl->mutex); 1001 mutex_unlock(&wl->mutex);
@@ -999,21 +1003,21 @@ out:
999 return ret; 1003 return ret;
1000} 1004}
1001 1005
1002static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, 1006static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
1003 struct ieee80211_vif *vif, 1007 struct ieee80211_vif *vif,
1004 struct ieee80211_bss_conf *bss_conf, 1008 struct ieee80211_bss_conf *bss_conf,
1005 u32 changed) 1009 u32 changed)
1006{ 1010{
1007 enum wl12xx_cmd_ps_mode mode; 1011 enum wl1251_cmd_ps_mode mode;
1008 struct wl12xx *wl = hw->priv; 1012 struct wl1251 *wl = hw->priv;
1009 struct sk_buff *beacon; 1013 struct sk_buff *beacon;
1010 int ret; 1014 int ret;
1011 1015
1012 wl12xx_debug(DEBUG_MAC80211, "mac80211 bss info changed"); 1016 wl1251_debug(DEBUG_MAC80211, "mac80211 bss info changed");
1013 1017
1014 mutex_lock(&wl->mutex); 1018 mutex_lock(&wl->mutex);
1015 1019
1016 ret = wl12xx_ps_elp_wakeup(wl); 1020 ret = wl1251_ps_elp_wakeup(wl);
1017 if (ret < 0) 1021 if (ret < 0)
1018 goto out; 1022 goto out;
1019 1023
@@ -1021,18 +1025,18 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1021 if (bss_conf->assoc) { 1025 if (bss_conf->assoc) {
1022 wl->aid = bss_conf->aid; 1026 wl->aid = bss_conf->aid;
1023 1027
1024 ret = wl12xx_build_ps_poll(wl, wl->aid); 1028 ret = wl1251_build_ps_poll(wl, wl->aid);
1025 if (ret < 0) 1029 if (ret < 0)
1026 goto out_sleep; 1030 goto out_sleep;
1027 1031
1028 ret = wl12xx_acx_aid(wl, wl->aid); 1032 ret = wl1251_acx_aid(wl, wl->aid);
1029 if (ret < 0) 1033 if (ret < 0)
1030 goto out_sleep; 1034 goto out_sleep;
1031 1035
1032 /* If we want to go in PSM but we're not there yet */ 1036 /* If we want to go in PSM but we're not there yet */
1033 if (wl->psm_requested && !wl->psm) { 1037 if (wl->psm_requested && !wl->psm) {
1034 mode = STATION_POWER_SAVE_MODE; 1038 mode = STATION_POWER_SAVE_MODE;
1035 ret = wl12xx_ps_set_mode(wl, mode); 1039 ret = wl1251_ps_set_mode(wl, mode);
1036 if (ret < 0) 1040 if (ret < 0)
1037 goto out_sleep; 1041 goto out_sleep;
1038 } 1042 }
@@ -1040,50 +1044,52 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1040 } 1044 }
1041 if (changed & BSS_CHANGED_ERP_SLOT) { 1045 if (changed & BSS_CHANGED_ERP_SLOT) {
1042 if (bss_conf->use_short_slot) 1046 if (bss_conf->use_short_slot)
1043 ret = wl12xx_acx_slot(wl, SLOT_TIME_SHORT); 1047 ret = wl1251_acx_slot(wl, SLOT_TIME_SHORT);
1044 else 1048 else
1045 ret = wl12xx_acx_slot(wl, SLOT_TIME_LONG); 1049 ret = wl1251_acx_slot(wl, SLOT_TIME_LONG);
1046 if (ret < 0) { 1050 if (ret < 0) {
1047 wl12xx_warning("Set slot time failed %d", ret); 1051 wl1251_warning("Set slot time failed %d", ret);
1048 goto out_sleep; 1052 goto out_sleep;
1049 } 1053 }
1050 } 1054 }
1051 1055
1052 if (changed & BSS_CHANGED_ERP_PREAMBLE) { 1056 if (changed & BSS_CHANGED_ERP_PREAMBLE) {
1053 if (bss_conf->use_short_preamble) 1057 if (bss_conf->use_short_preamble)
1054 wl12xx_acx_set_preamble(wl, ACX_PREAMBLE_SHORT); 1058 wl1251_acx_set_preamble(wl, ACX_PREAMBLE_SHORT);
1055 else 1059 else
1056 wl12xx_acx_set_preamble(wl, ACX_PREAMBLE_LONG); 1060 wl1251_acx_set_preamble(wl, ACX_PREAMBLE_LONG);
1057 } 1061 }
1058 1062
1059 if (changed & BSS_CHANGED_ERP_CTS_PROT) { 1063 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
1060 if (bss_conf->use_cts_prot) 1064 if (bss_conf->use_cts_prot)
1061 ret = wl12xx_acx_cts_protect(wl, CTSPROTECT_ENABLE); 1065 ret = wl1251_acx_cts_protect(wl, CTSPROTECT_ENABLE);
1062 else 1066 else
1063 ret = wl12xx_acx_cts_protect(wl, CTSPROTECT_DISABLE); 1067 ret = wl1251_acx_cts_protect(wl, CTSPROTECT_DISABLE);
1064 if (ret < 0) { 1068 if (ret < 0) {
1065 wl12xx_warning("Set ctsprotect failed %d", ret); 1069 wl1251_warning("Set ctsprotect failed %d", ret);
1066 goto out_sleep; 1070 goto out;
1067 } 1071 }
1068 } 1072 }
1069 1073
1070 if (changed & BSS_CHANGED_BSSID) { 1074 if (changed & BSS_CHANGED_BSSID) {
1071 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); 1075 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
1072 1076
1073 ret = wl12xx_build_null_data(wl); 1077 ret = wl1251_build_null_data(wl);
1074 if (ret < 0) 1078 if (ret < 0)
1075 goto out; 1079 goto out;
1076 1080
1077 if (wl->bss_type != BSS_TYPE_IBSS) { 1081 if (wl->bss_type != BSS_TYPE_IBSS) {
1078 ret = wl->chip.op_cmd_join(wl, wl->bss_type, 5, 100, 1); 1082 ret = wl1251_cmd_join(wl, wl->bss_type, 5, 100, 1);
1079 if (ret < 0) 1083 if (ret < 0)
1080 goto out; 1084 goto out_sleep;
1085 wl1251_warning("Set ctsprotect failed %d", ret);
1086 goto out_sleep;
1081 } 1087 }
1082 } 1088 }
1083 1089
1084 if (changed & BSS_CHANGED_BEACON) { 1090 if (changed & BSS_CHANGED_BEACON) {
1085 beacon = ieee80211_beacon_get(hw, vif); 1091 beacon = ieee80211_beacon_get(hw, vif);
1086 ret = wl12xx_cmd_template_set(wl, CMD_BEACON, beacon->data, 1092 ret = wl1251_cmd_template_set(wl, CMD_BEACON, beacon->data,
1087 beacon->len); 1093 beacon->len);
1088 1094
1089 if (ret < 0) { 1095 if (ret < 0) {
@@ -1091,7 +1097,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1091 goto out; 1097 goto out;
1092 } 1098 }
1093 1099
1094 ret = wl12xx_cmd_template_set(wl, CMD_PROBE_RESP, beacon->data, 1100 ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, beacon->data,
1095 beacon->len); 1101 beacon->len);
1096 1102
1097 dev_kfree_skb(beacon); 1103 dev_kfree_skb(beacon);
@@ -1106,7 +1112,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1106 } 1112 }
1107 1113
1108out_sleep: 1114out_sleep:
1109 wl12xx_ps_elp_sleep(wl); 1115 wl1251_ps_elp_sleep(wl);
1110 1116
1111out: 1117out:
1112 mutex_unlock(&wl->mutex); 1118 mutex_unlock(&wl->mutex);
@@ -1114,7 +1120,7 @@ out:
1114 1120
1115 1121
1116/* can't be const, mac80211 writes to this */ 1122/* can't be const, mac80211 writes to this */
1117static struct ieee80211_rate wl12xx_rates[] = { 1123static struct ieee80211_rate wl1251_rates[] = {
1118 { .bitrate = 10, 1124 { .bitrate = 10,
1119 .hw_value = 0x1, 1125 .hw_value = 0x1,
1120 .hw_value_short = 0x1, }, 1126 .hw_value_short = 0x1, },
@@ -1157,7 +1163,7 @@ static struct ieee80211_rate wl12xx_rates[] = {
1157}; 1163};
1158 1164
1159/* can't be const, mac80211 writes to this */ 1165/* can't be const, mac80211 writes to this */
1160static struct ieee80211_channel wl12xx_channels[] = { 1166static struct ieee80211_channel wl1251_channels[] = {
1161 { .hw_value = 1, .center_freq = 2412}, 1167 { .hw_value = 1, .center_freq = 2412},
1162 { .hw_value = 2, .center_freq = 2417}, 1168 { .hw_value = 2, .center_freq = 2417},
1163 { .hw_value = 3, .center_freq = 2422}, 1169 { .hw_value = 3, .center_freq = 2422},
@@ -1174,28 +1180,28 @@ static struct ieee80211_channel wl12xx_channels[] = {
1174}; 1180};
1175 1181
1176/* can't be const, mac80211 writes to this */ 1182/* can't be const, mac80211 writes to this */
1177static struct ieee80211_supported_band wl12xx_band_2ghz = { 1183static struct ieee80211_supported_band wl1251_band_2ghz = {
1178 .channels = wl12xx_channels, 1184 .channels = wl1251_channels,
1179 .n_channels = ARRAY_SIZE(wl12xx_channels), 1185 .n_channels = ARRAY_SIZE(wl1251_channels),
1180 .bitrates = wl12xx_rates, 1186 .bitrates = wl1251_rates,
1181 .n_bitrates = ARRAY_SIZE(wl12xx_rates), 1187 .n_bitrates = ARRAY_SIZE(wl1251_rates),
1182}; 1188};
1183 1189
1184static const struct ieee80211_ops wl12xx_ops = { 1190static const struct ieee80211_ops wl1251_ops = {
1185 .start = wl12xx_op_start, 1191 .start = wl1251_op_start,
1186 .stop = wl12xx_op_stop, 1192 .stop = wl1251_op_stop,
1187 .add_interface = wl12xx_op_add_interface, 1193 .add_interface = wl1251_op_add_interface,
1188 .remove_interface = wl12xx_op_remove_interface, 1194 .remove_interface = wl1251_op_remove_interface,
1189 .config = wl12xx_op_config, 1195 .config = wl1251_op_config,
1190 .configure_filter = wl12xx_op_configure_filter, 1196 .configure_filter = wl1251_op_configure_filter,
1191 .tx = wl12xx_op_tx, 1197 .tx = wl1251_op_tx,
1192 .set_key = wl12xx_op_set_key, 1198 .set_key = wl1251_op_set_key,
1193 .hw_scan = wl12xx_op_hw_scan, 1199 .hw_scan = wl1251_op_hw_scan,
1194 .bss_info_changed = wl12xx_op_bss_info_changed, 1200 .bss_info_changed = wl1251_op_bss_info_changed,
1195 .set_rts_threshold = wl12xx_op_set_rts_threshold, 1201 .set_rts_threshold = wl1251_op_set_rts_threshold,
1196}; 1202};
1197 1203
1198static int wl12xx_register_hw(struct wl12xx *wl) 1204static int wl1251_register_hw(struct wl1251 *wl)
1199{ 1205{
1200 int ret; 1206 int ret;
1201 1207
@@ -1206,18 +1212,18 @@ static int wl12xx_register_hw(struct wl12xx *wl)
1206 1212
1207 ret = ieee80211_register_hw(wl->hw); 1213 ret = ieee80211_register_hw(wl->hw);
1208 if (ret < 0) { 1214 if (ret < 0) {
1209 wl12xx_error("unable to register mac80211 hw: %d", ret); 1215 wl1251_error("unable to register mac80211 hw: %d", ret);
1210 return ret; 1216 return ret;
1211 } 1217 }
1212 1218
1213 wl->mac80211_registered = true; 1219 wl->mac80211_registered = true;
1214 1220
1215 wl12xx_notice("loaded"); 1221 wl1251_notice("loaded");
1216 1222
1217 return 0; 1223 return 0;
1218} 1224}
1219 1225
1220static int wl12xx_init_ieee80211(struct wl12xx *wl) 1226static int wl1251_init_ieee80211(struct wl1251 *wl)
1221{ 1227{
1222 /* The tx descriptor buffer and the TKIP space */ 1228 /* The tx descriptor buffer and the TKIP space */
1223 wl->hw->extra_tx_headroom = sizeof(struct tx_double_buffer_desc) 1229 wl->hw->extra_tx_headroom = sizeof(struct tx_double_buffer_desc)
@@ -1232,31 +1238,31 @@ static int wl12xx_init_ieee80211(struct wl12xx *wl)
1232 1238
1233 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 1239 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
1234 wl->hw->wiphy->max_scan_ssids = 1; 1240 wl->hw->wiphy->max_scan_ssids = 1;
1235 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl12xx_band_2ghz; 1241 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1251_band_2ghz;
1236 1242
1237 SET_IEEE80211_DEV(wl->hw, &wl->spi->dev); 1243 SET_IEEE80211_DEV(wl->hw, &wl->spi->dev);
1238 1244
1239 return 0; 1245 return 0;
1240} 1246}
1241 1247
1242#define WL12XX_DEFAULT_CHANNEL 1 1248#define WL1251_DEFAULT_CHANNEL 1
1243static int __devinit wl12xx_probe(struct spi_device *spi) 1249static int __devinit wl1251_probe(struct spi_device *spi)
1244{ 1250{
1245 struct wl12xx_platform_data *pdata; 1251 struct wl12xx_platform_data *pdata;
1246 struct ieee80211_hw *hw; 1252 struct ieee80211_hw *hw;
1247 struct wl12xx *wl; 1253 struct wl1251 *wl;
1248 int ret, i; 1254 int ret, i;
1249 static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf}; 1255 static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf};
1250 1256
1251 pdata = spi->dev.platform_data; 1257 pdata = spi->dev.platform_data;
1252 if (!pdata) { 1258 if (!pdata) {
1253 wl12xx_error("no platform data"); 1259 wl1251_error("no platform data");
1254 return -ENODEV; 1260 return -ENODEV;
1255 } 1261 }
1256 1262
1257 hw = ieee80211_alloc_hw(sizeof(*wl), &wl12xx_ops); 1263 hw = ieee80211_alloc_hw(sizeof(*wl), &wl1251_ops);
1258 if (!hw) { 1264 if (!hw) {
1259 wl12xx_error("could not alloc ieee80211_hw"); 1265 wl1251_error("could not alloc ieee80211_hw");
1260 return -ENOMEM; 1266 return -ENOMEM;
1261 } 1267 }
1262 1268
@@ -1271,8 +1277,8 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1271 1277
1272 skb_queue_head_init(&wl->tx_queue); 1278 skb_queue_head_init(&wl->tx_queue);
1273 1279
1274 INIT_WORK(&wl->filter_work, wl12xx_filter_work); 1280 INIT_WORK(&wl->filter_work, wl1251_filter_work);
1275 wl->channel = WL12XX_DEFAULT_CHANNEL; 1281 wl->channel = WL1251_DEFAULT_CHANNEL;
1276 wl->scanning = false; 1282 wl->scanning = false;
1277 wl->default_key = 0; 1283 wl->default_key = 0;
1278 wl->listen_int = 1; 1284 wl->listen_int = 1;
@@ -1280,17 +1286,17 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1280 wl->rx_handled = 0; 1286 wl->rx_handled = 0;
1281 wl->rx_current_buffer = 0; 1287 wl->rx_current_buffer = 0;
1282 wl->rx_last_id = 0; 1288 wl->rx_last_id = 0;
1283 wl->rx_config = WL12XX_DEFAULT_RX_CONFIG; 1289 wl->rx_config = WL1251_DEFAULT_RX_CONFIG;
1284 wl->rx_filter = WL12XX_DEFAULT_RX_FILTER; 1290 wl->rx_filter = WL1251_DEFAULT_RX_FILTER;
1285 wl->elp = false; 1291 wl->elp = false;
1286 wl->psm = 0; 1292 wl->psm = 0;
1287 wl->psm_requested = false; 1293 wl->psm_requested = false;
1288 wl->tx_queue_stopped = false; 1294 wl->tx_queue_stopped = false;
1289 wl->power_level = WL12XX_DEFAULT_POWER_LEVEL; 1295 wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
1290 1296
1291 /* We use the default power on sleep time until we know which chip 1297 /* We use the default power on sleep time until we know which chip
1292 * we're using */ 1298 * we're using */
1293 wl->chip.power_on_sleep = WL12XX_DEFAULT_POWER_ON_SLEEP; 1299 wl->chip.power_on_sleep = WL1251_DEFAULT_POWER_ON_SLEEP;
1294 1300
1295 for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++) 1301 for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++)
1296 wl->tx_frames[i] = NULL; 1302 wl->tx_frames[i] = NULL;
@@ -1304,7 +1310,7 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1304 memcpy(wl->mac_addr, nokia_oui, 3); 1310 memcpy(wl->mac_addr, nokia_oui, 3);
1305 get_random_bytes(wl->mac_addr + 3, 3); 1311 get_random_bytes(wl->mac_addr + 3, 3);
1306 1312
1307 wl->state = WL12XX_STATE_OFF; 1313 wl->state = WL1251_STATE_OFF;
1308 mutex_init(&wl->mutex); 1314 mutex_init(&wl->mutex);
1309 1315
1310 wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE; 1316 wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE;
@@ -1312,7 +1318,7 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1312 1318
1313 wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL); 1319 wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL);
1314 if (!wl->rx_descriptor) { 1320 if (!wl->rx_descriptor) {
1315 wl12xx_error("could not allocate memory for rx descriptor"); 1321 wl1251_error("could not allocate memory for rx descriptor");
1316 ret = -ENOMEM; 1322 ret = -ENOMEM;
1317 goto out_free; 1323 goto out_free;
1318 } 1324 }
@@ -1323,27 +1329,27 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1323 1329
1324 ret = spi_setup(spi); 1330 ret = spi_setup(spi);
1325 if (ret < 0) { 1331 if (ret < 0) {
1326 wl12xx_error("spi_setup failed"); 1332 wl1251_error("spi_setup failed");
1327 goto out_free; 1333 goto out_free;
1328 } 1334 }
1329 1335
1330 wl->set_power = pdata->set_power; 1336 wl->set_power = pdata->set_power;
1331 if (!wl->set_power) { 1337 if (!wl->set_power) {
1332 wl12xx_error("set power function missing in platform data"); 1338 wl1251_error("set power function missing in platform data");
1333 ret = -ENODEV; 1339 ret = -ENODEV;
1334 goto out_free; 1340 goto out_free;
1335 } 1341 }
1336 1342
1337 wl->irq = spi->irq; 1343 wl->irq = spi->irq;
1338 if (wl->irq < 0) { 1344 if (wl->irq < 0) {
1339 wl12xx_error("irq missing in platform data"); 1345 wl1251_error("irq missing in platform data");
1340 ret = -ENODEV; 1346 ret = -ENODEV;
1341 goto out_free; 1347 goto out_free;
1342 } 1348 }
1343 1349
1344 ret = request_irq(wl->irq, wl12xx_irq, 0, DRIVER_NAME, wl); 1350 ret = request_irq(wl->irq, wl1251_irq, 0, DRIVER_NAME, wl);
1345 if (ret < 0) { 1351 if (ret < 0) {
1346 wl12xx_error("request_irq() failed: %d", ret); 1352 wl1251_error("request_irq() failed: %d", ret);
1347 goto out_free; 1353 goto out_free;
1348 } 1354 }
1349 1355
@@ -1351,17 +1357,17 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1351 1357
1352 disable_irq(wl->irq); 1358 disable_irq(wl->irq);
1353 1359
1354 ret = wl12xx_init_ieee80211(wl); 1360 ret = wl1251_init_ieee80211(wl);
1355 if (ret) 1361 if (ret)
1356 goto out_irq; 1362 goto out_irq;
1357 1363
1358 ret = wl12xx_register_hw(wl); 1364 ret = wl1251_register_hw(wl);
1359 if (ret) 1365 if (ret)
1360 goto out_irq; 1366 goto out_irq;
1361 1367
1362 wl12xx_debugfs_init(wl); 1368 wl1251_debugfs_init(wl);
1363 1369
1364 wl12xx_notice("initialized"); 1370 wl1251_notice("initialized");
1365 1371
1366 return 0; 1372 return 0;
1367 1373
@@ -1377,13 +1383,13 @@ static int __devinit wl12xx_probe(struct spi_device *spi)
1377 return ret; 1383 return ret;
1378} 1384}
1379 1385
1380static int __devexit wl12xx_remove(struct spi_device *spi) 1386static int __devexit wl1251_remove(struct spi_device *spi)
1381{ 1387{
1382 struct wl12xx *wl = dev_get_drvdata(&spi->dev); 1388 struct wl1251 *wl = dev_get_drvdata(&spi->dev);
1383 1389
1384 ieee80211_unregister_hw(wl->hw); 1390 ieee80211_unregister_hw(wl->hw);
1385 1391
1386 wl12xx_debugfs_exit(wl); 1392 wl1251_debugfs_exit(wl);
1387 1393
1388 free_irq(wl->irq, wl); 1394 free_irq(wl->irq, wl);
1389 kfree(wl->target_mem_map); 1395 kfree(wl->target_mem_map);
@@ -1402,24 +1408,25 @@ static int __devexit wl12xx_remove(struct spi_device *spi)
1402} 1408}
1403 1409
1404 1410
1405static struct spi_driver wl12xx_spi_driver = { 1411static struct spi_driver wl1251_spi_driver = {
1406 .driver = { 1412 .driver = {
1413 /* FIXME: use wl12xx name to not break the user space */
1407 .name = "wl12xx", 1414 .name = "wl12xx",
1408 .bus = &spi_bus_type, 1415 .bus = &spi_bus_type,
1409 .owner = THIS_MODULE, 1416 .owner = THIS_MODULE,
1410 }, 1417 },
1411 1418
1412 .probe = wl12xx_probe, 1419 .probe = wl1251_probe,
1413 .remove = __devexit_p(wl12xx_remove), 1420 .remove = __devexit_p(wl1251_remove),
1414}; 1421};
1415 1422
1416static int __init wl12xx_init(void) 1423static int __init wl1251_init(void)
1417{ 1424{
1418 int ret; 1425 int ret;
1419 1426
1420 ret = spi_register_driver(&wl12xx_spi_driver); 1427 ret = spi_register_driver(&wl1251_spi_driver);
1421 if (ret < 0) { 1428 if (ret < 0) {
1422 wl12xx_error("failed to register spi driver: %d", ret); 1429 wl1251_error("failed to register spi driver: %d", ret);
1423 goto out; 1430 goto out;
1424 } 1431 }
1425 1432
@@ -1427,15 +1434,15 @@ out:
1427 return ret; 1434 return ret;
1428} 1435}
1429 1436
1430static void __exit wl12xx_exit(void) 1437static void __exit wl1251_exit(void)
1431{ 1438{
1432 spi_unregister_driver(&wl12xx_spi_driver); 1439 spi_unregister_driver(&wl1251_spi_driver);
1433 1440
1434 wl12xx_notice("unloaded"); 1441 wl1251_notice("unloaded");
1435} 1442}
1436 1443
1437module_init(wl12xx_init); 1444module_init(wl1251_init);
1438module_exit(wl12xx_exit); 1445module_exit(wl1251_exit);
1439 1446
1440MODULE_LICENSE("GPL"); 1447MODULE_LICENSE("GPL");
1441MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>, " 1448MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>, "