aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-05-16 14:55:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-05-16 19:32:19 -0400
commite00cf3b9eb7839b952e434a75bff6b99e47337ac (patch)
treeef583ab8ac09bf703026650d4bc7777e6a3864d3 /drivers/net/wireless/libertas
parent1a8218e96271790a07dd7065a2ef173e0f67e328 (diff)
parent3b8ab88acaceb505aa06ef3bbf3a73b92470ae78 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts: drivers/net/wireless/iwlwifi/iwl-agn-tx.c net/mac80211/sta_info.h
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/cfg.c16
-rw-r--r--drivers/net/wireless/libertas/cmd.c40
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c27
-rw-r--r--drivers/net/wireless/libertas/debugfs.c5
-rw-r--r--drivers/net/wireless/libertas/defs.h7
-rw-r--r--drivers/net/wireless/libertas/if_cs.c57
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c37
-rw-r--r--drivers/net/wireless/libertas/if_spi.c83
-rw-r--r--drivers/net/wireless/libertas/if_usb.c44
-rw-r--r--drivers/net/wireless/libertas/main.c72
-rw-r--r--drivers/net/wireless/libertas/mesh.c8
-rw-r--r--drivers/net/wireless/libertas/rx.c7
12 files changed, 213 insertions, 190 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 486544e01a56..5d637af2d7c3 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -6,6 +6,8 @@
6 * 6 *
7 */ 7 */
8 8
9#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
10
9#include <linux/sched.h> 11#include <linux/sched.h>
10#include <linux/wait.h> 12#include <linux/wait.h>
11#include <linux/slab.h> 13#include <linux/slab.h>
@@ -1322,8 +1324,8 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
1322 sme->ssid, sme->ssid_len, 1324 sme->ssid, sme->ssid_len,
1323 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); 1325 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
1324 if (!bss) { 1326 if (!bss) {
1325 lbs_pr_err("assoc: bss %pM not in scan results\n", 1327 wiphy_err(wiphy, "assoc: bss %pM not in scan results\n",
1326 sme->bssid); 1328 sme->bssid);
1327 ret = -ENOENT; 1329 ret = -ENOENT;
1328 goto done; 1330 goto done;
1329 } 1331 }
@@ -1380,8 +1382,8 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
1380 lbs_enable_rsn(priv, sme->crypto.cipher_group != 0); 1382 lbs_enable_rsn(priv, sme->crypto.cipher_group != 0);
1381 break; 1383 break;
1382 default: 1384 default:
1383 lbs_pr_err("unsupported cipher group 0x%x\n", 1385 wiphy_err(wiphy, "unsupported cipher group 0x%x\n",
1384 sme->crypto.cipher_group); 1386 sme->crypto.cipher_group);
1385 ret = -ENOTSUPP; 1387 ret = -ENOTSUPP;
1386 goto done; 1388 goto done;
1387 } 1389 }
@@ -1499,7 +1501,7 @@ static int lbs_cfg_add_key(struct wiphy *wiphy, struct net_device *netdev,
1499 params->key, params->key_len); 1501 params->key, params->key_len);
1500 break; 1502 break;
1501 default: 1503 default:
1502 lbs_pr_err("unhandled cipher 0x%x\n", params->cipher); 1504 wiphy_err(wiphy, "unhandled cipher 0x%x\n", params->cipher);
1503 ret = -ENOTSUPP; 1505 ret = -ENOTSUPP;
1504 break; 1506 break;
1505 } 1507 }
@@ -2127,13 +2129,13 @@ int lbs_cfg_register(struct lbs_private *priv)
2127 2129
2128 ret = wiphy_register(wdev->wiphy); 2130 ret = wiphy_register(wdev->wiphy);
2129 if (ret < 0) 2131 if (ret < 0)
2130 lbs_pr_err("cannot register wiphy device\n"); 2132 pr_err("cannot register wiphy device\n");
2131 2133
2132 priv->wiphy_registered = true; 2134 priv->wiphy_registered = true;
2133 2135
2134 ret = register_netdev(priv->dev); 2136 ret = register_netdev(priv->dev);
2135 if (ret) 2137 if (ret)
2136 lbs_pr_err("cannot register network device\n"); 2138 pr_err("cannot register network device\n");
2137 2139
2138 INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker); 2140 INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker);
2139 2141
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 6a96fc9c1cea..6d59b4cf8fce 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -110,7 +110,7 @@ int lbs_update_hw_spec(struct lbs_private *priv)
110 * CF card firmware 5.0.16p0: cap 0x00000303 110 * CF card firmware 5.0.16p0: cap 0x00000303
111 * USB dongle firmware 5.110.17p2: cap 0x00000303 111 * USB dongle firmware 5.110.17p2: cap 0x00000303
112 */ 112 */
113 lbs_pr_info("%pM, fw %u.%u.%up%u, cap 0x%08x\n", 113 netdev_info(priv->dev, "%pM, fw %u.%u.%up%u, cap 0x%08x\n",
114 cmd.permanentaddr, 114 cmd.permanentaddr,
115 priv->fwrelease >> 24 & 0xff, 115 priv->fwrelease >> 24 & 0xff,
116 priv->fwrelease >> 16 & 0xff, 116 priv->fwrelease >> 16 & 0xff,
@@ -141,7 +141,8 @@ int lbs_update_hw_spec(struct lbs_private *priv)
141 /* if it's unidentified region code, use the default (USA) */ 141 /* if it's unidentified region code, use the default (USA) */
142 if (i >= MRVDRV_MAX_REGION_CODE) { 142 if (i >= MRVDRV_MAX_REGION_CODE) {
143 priv->regioncode = 0x10; 143 priv->regioncode = 0x10;
144 lbs_pr_info("unidentified region code; using the default (USA)\n"); 144 netdev_info(priv->dev,
145 "unidentified region code; using the default (USA)\n");
145 } 146 }
146 147
147 if (priv->current_addr[0] == 0xff) 148 if (priv->current_addr[0] == 0xff)
@@ -211,7 +212,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,
211 (uint8_t *)&cmd_config.wol_conf, 212 (uint8_t *)&cmd_config.wol_conf,
212 sizeof(struct wol_config)); 213 sizeof(struct wol_config));
213 } else { 214 } else {
214 lbs_pr_info("HOST_SLEEP_CFG failed %d\n", ret); 215 netdev_info(priv->dev, "HOST_SLEEP_CFG failed %d\n", ret);
215 } 216 }
216 217
217 return ret; 218 return ret;
@@ -314,7 +315,7 @@ static int lbs_wait_for_ds_awake(struct lbs_private *priv)
314 if (priv->is_deep_sleep) { 315 if (priv->is_deep_sleep) {
315 if (!wait_event_interruptible_timeout(priv->ds_awake_q, 316 if (!wait_event_interruptible_timeout(priv->ds_awake_q,
316 !priv->is_deep_sleep, (10 * HZ))) { 317 !priv->is_deep_sleep, (10 * HZ))) {
317 lbs_pr_err("ds_awake_q: timer expired\n"); 318 netdev_err(priv->dev, "ds_awake_q: timer expired\n");
318 ret = -1; 319 ret = -1;
319 } 320 }
320 } 321 }
@@ -339,7 +340,7 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep)
339 netif_carrier_off(priv->dev); 340 netif_carrier_off(priv->dev);
340 } 341 }
341 } else { 342 } else {
342 lbs_pr_err("deep sleep: already enabled\n"); 343 netdev_err(priv->dev, "deep sleep: already enabled\n");
343 } 344 }
344 } else { 345 } else {
345 if (priv->is_deep_sleep) { 346 if (priv->is_deep_sleep) {
@@ -349,8 +350,8 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep)
349 if (!ret) { 350 if (!ret) {
350 ret = lbs_wait_for_ds_awake(priv); 351 ret = lbs_wait_for_ds_awake(priv);
351 if (ret) 352 if (ret)
352 lbs_pr_err("deep sleep: wakeup" 353 netdev_err(priv->dev,
353 "failed\n"); 354 "deep sleep: wakeup failed\n");
354 } 355 }
355 } 356 }
356 } 357 }
@@ -384,8 +385,9 @@ int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep)
384 ret = lbs_host_sleep_cfg(priv, priv->wol_criteria, 385 ret = lbs_host_sleep_cfg(priv, priv->wol_criteria,
385 (struct wol_config *)NULL); 386 (struct wol_config *)NULL);
386 if (ret) { 387 if (ret) {
387 lbs_pr_info("Host sleep configuration failed: " 388 netdev_info(priv->dev,
388 "%d\n", ret); 389 "Host sleep configuration failed: %d\n",
390 ret);
389 return ret; 391 return ret;
390 } 392 }
391 if (priv->psstate == PS_STATE_FULL_POWER) { 393 if (priv->psstate == PS_STATE_FULL_POWER) {
@@ -395,19 +397,21 @@ int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep)
395 sizeof(cmd), 397 sizeof(cmd),
396 lbs_ret_host_sleep_activate, 0); 398 lbs_ret_host_sleep_activate, 0);
397 if (ret) 399 if (ret)
398 lbs_pr_info("HOST_SLEEP_ACTIVATE " 400 netdev_info(priv->dev,
399 "failed: %d\n", ret); 401 "HOST_SLEEP_ACTIVATE failed: %d\n",
402 ret);
400 } 403 }
401 404
402 if (!wait_event_interruptible_timeout( 405 if (!wait_event_interruptible_timeout(
403 priv->host_sleep_q, 406 priv->host_sleep_q,
404 priv->is_host_sleep_activated, 407 priv->is_host_sleep_activated,
405 (10 * HZ))) { 408 (10 * HZ))) {
406 lbs_pr_err("host_sleep_q: timer expired\n"); 409 netdev_err(priv->dev,
410 "host_sleep_q: timer expired\n");
407 ret = -1; 411 ret = -1;
408 } 412 }
409 } else { 413 } else {
410 lbs_pr_err("host sleep: already enabled\n"); 414 netdev_err(priv->dev, "host sleep: already enabled\n");
411 } 415 }
412 } else { 416 } else {
413 if (priv->is_host_sleep_activated) 417 if (priv->is_host_sleep_activated)
@@ -1007,7 +1011,8 @@ static void lbs_submit_command(struct lbs_private *priv,
1007 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); 1011 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize);
1008 1012
1009 if (ret) { 1013 if (ret) {
1010 lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); 1014 netdev_info(priv->dev, "DNLD_CMD: hw_host_to_card failed: %d\n",
1015 ret);
1011 /* Let the timer kick in and retry, and potentially reset 1016 /* Let the timer kick in and retry, and potentially reset
1012 the whole thing if the condition persists */ 1017 the whole thing if the condition persists */
1013 timeo = HZ/4; 1018 timeo = HZ/4;
@@ -1276,7 +1281,8 @@ int lbs_execute_next_command(struct lbs_private *priv)
1276 spin_lock_irqsave(&priv->driver_lock, flags); 1281 spin_lock_irqsave(&priv->driver_lock, flags);
1277 1282
1278 if (priv->cur_cmd) { 1283 if (priv->cur_cmd) {
1279 lbs_pr_alert( "EXEC_NEXT_CMD: already processing command!\n"); 1284 netdev_alert(priv->dev,
1285 "EXEC_NEXT_CMD: already processing command!\n");
1280 spin_unlock_irqrestore(&priv->driver_lock, flags); 1286 spin_unlock_irqrestore(&priv->driver_lock, flags);
1281 ret = -1; 1287 ret = -1;
1282 goto done; 1288 goto done;
@@ -1438,7 +1444,7 @@ static void lbs_send_confirmsleep(struct lbs_private *priv)
1438 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &confirm_sleep, 1444 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &confirm_sleep,
1439 sizeof(confirm_sleep)); 1445 sizeof(confirm_sleep));
1440 if (ret) { 1446 if (ret) {
1441 lbs_pr_alert("confirm_sleep failed\n"); 1447 netdev_alert(priv->dev, "confirm_sleep failed\n");
1442 goto out; 1448 goto out;
1443 } 1449 }
1444 1450
@@ -1664,7 +1670,7 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
1664 spin_lock_irqsave(&priv->driver_lock, flags); 1670 spin_lock_irqsave(&priv->driver_lock, flags);
1665 ret = cmdnode->result; 1671 ret = cmdnode->result;
1666 if (ret) 1672 if (ret)
1667 lbs_pr_info("PREP_CMD: command 0x%04x failed: %d\n", 1673 netdev_info(priv->dev, "PREP_CMD: command 0x%04x failed: %d\n",
1668 command, ret); 1674 command, ret);
1669 1675
1670 __lbs_cleanup_and_insert_cmd(priv, cmdnode); 1676 __lbs_cleanup_and_insert_cmd(priv, cmdnode);
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 03e528994a9e..207fc361db84 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -2,6 +2,7 @@
2 * This file contains the handling of command 2 * This file contains the handling of command
3 * responses as well as events generated by firmware. 3 * responses as well as events generated by firmware.
4 */ 4 */
5
5#include <linux/slab.h> 6#include <linux/slab.h>
6#include <linux/delay.h> 7#include <linux/delay.h>
7#include <linux/sched.h> 8#include <linux/sched.h>
@@ -85,15 +86,18 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
85 lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len); 86 lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len);
86 87
87 if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) { 88 if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) {
88 lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n", 89 netdev_info(priv->dev,
89 le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum)); 90 "Received CMD_RESP with invalid sequence %d (expected %d)\n",
91 le16_to_cpu(resp->seqnum),
92 le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
90 spin_unlock_irqrestore(&priv->driver_lock, flags); 93 spin_unlock_irqrestore(&priv->driver_lock, flags);
91 ret = -1; 94 ret = -1;
92 goto done; 95 goto done;
93 } 96 }
94 if (respcmd != CMD_RET(curcmd) && 97 if (respcmd != CMD_RET(curcmd) &&
95 respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) { 98 respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) {
96 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); 99 netdev_info(priv->dev, "Invalid CMD_RESP %x to command %x!\n",
100 respcmd, curcmd);
97 spin_unlock_irqrestore(&priv->driver_lock, flags); 101 spin_unlock_irqrestore(&priv->driver_lock, flags);
98 ret = -1; 102 ret = -1;
99 goto done; 103 goto done;
@@ -102,7 +106,8 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
102 if (resp->result == cpu_to_le16(0x0004)) { 106 if (resp->result == cpu_to_le16(0x0004)) {
103 /* 0x0004 means -EAGAIN. Drop the response, let it time out 107 /* 0x0004 means -EAGAIN. Drop the response, let it time out
104 and be resubmitted */ 108 and be resubmitted */
105 lbs_pr_info("Firmware returns DEFER to command %x. Will let it time out...\n", 109 netdev_info(priv->dev,
110 "Firmware returns DEFER to command %x. Will let it time out...\n",
106 le16_to_cpu(resp->command)); 111 le16_to_cpu(resp->command));
107 spin_unlock_irqrestore(&priv->driver_lock, flags); 112 spin_unlock_irqrestore(&priv->driver_lock, flags);
108 ret = -1; 113 ret = -1;
@@ -314,28 +319,28 @@ int lbs_process_event(struct lbs_private *priv, u32 event)
314 lbs_deb_cmd("EVENT: ADHOC beacon lost\n"); 319 lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
315 break; 320 break;
316 case MACREG_INT_CODE_RSSI_LOW: 321 case MACREG_INT_CODE_RSSI_LOW:
317 lbs_pr_alert("EVENT: rssi low\n"); 322 netdev_alert(priv->dev, "EVENT: rssi low\n");
318 break; 323 break;
319 case MACREG_INT_CODE_SNR_LOW: 324 case MACREG_INT_CODE_SNR_LOW:
320 lbs_pr_alert("EVENT: snr low\n"); 325 netdev_alert(priv->dev, "EVENT: snr low\n");
321 break; 326 break;
322 case MACREG_INT_CODE_MAX_FAIL: 327 case MACREG_INT_CODE_MAX_FAIL:
323 lbs_pr_alert("EVENT: max fail\n"); 328 netdev_alert(priv->dev, "EVENT: max fail\n");
324 break; 329 break;
325 case MACREG_INT_CODE_RSSI_HIGH: 330 case MACREG_INT_CODE_RSSI_HIGH:
326 lbs_pr_alert("EVENT: rssi high\n"); 331 netdev_alert(priv->dev, "EVENT: rssi high\n");
327 break; 332 break;
328 case MACREG_INT_CODE_SNR_HIGH: 333 case MACREG_INT_CODE_SNR_HIGH:
329 lbs_pr_alert("EVENT: snr high\n"); 334 netdev_alert(priv->dev, "EVENT: snr high\n");
330 break; 335 break;
331 336
332 case MACREG_INT_CODE_MESH_AUTO_STARTED: 337 case MACREG_INT_CODE_MESH_AUTO_STARTED:
333 /* Ignore spurious autostart events */ 338 /* Ignore spurious autostart events */
334 lbs_pr_info("EVENT: MESH_AUTO_STARTED (ignoring)\n"); 339 netdev_info(priv->dev, "EVENT: MESH_AUTO_STARTED (ignoring)\n");
335 break; 340 break;
336 341
337 default: 342 default:
338 lbs_pr_alert("EVENT: unknown event id %d\n", event); 343 netdev_alert(priv->dev, "EVENT: unknown event id %d\n", event);
339 break; 344 break;
340 } 345 }
341 346
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 851fe7bd4ba4..23250f621761 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -151,13 +151,14 @@ static ssize_t lbs_host_sleep_write(struct file *file,
151 ret = lbs_set_host_sleep(priv, 0); 151 ret = lbs_set_host_sleep(priv, 0);
152 else if (host_sleep == 1) { 152 else if (host_sleep == 1) {
153 if (priv->wol_criteria == EHS_REMOVE_WAKEUP) { 153 if (priv->wol_criteria == EHS_REMOVE_WAKEUP) {
154 lbs_pr_info("wake parameters not configured"); 154 netdev_info(priv->dev,
155 "wake parameters not configured\n");
155 ret = -EINVAL; 156 ret = -EINVAL;
156 goto out_unlock; 157 goto out_unlock;
157 } 158 }
158 ret = lbs_set_host_sleep(priv, 1); 159 ret = lbs_set_host_sleep(priv, 1);
159 } else { 160 } else {
160 lbs_pr_err("invalid option\n"); 161 netdev_err(priv->dev, "invalid option\n");
161 ret = -EINVAL; 162 ret = -EINVAL;
162 } 163 }
163 164
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h
index 92b5b1f8fd75..ab966f08024a 100644
--- a/drivers/net/wireless/libertas/defs.h
+++ b/drivers/net/wireless/libertas/defs.h
@@ -89,13 +89,6 @@ do { if ((lbs_debug & (grp)) == (grp)) \
89#define lbs_deb_spi(fmt, args...) LBS_DEB_LL(LBS_DEB_SPI, " spi", fmt, ##args) 89#define lbs_deb_spi(fmt, args...) LBS_DEB_LL(LBS_DEB_SPI, " spi", fmt, ##args)
90#define lbs_deb_cfg80211(fmt, args...) LBS_DEB_LL(LBS_DEB_CFG80211, " cfg80211", fmt, ##args) 90#define lbs_deb_cfg80211(fmt, args...) LBS_DEB_LL(LBS_DEB_CFG80211, " cfg80211", fmt, ##args)
91 91
92#define lbs_pr_info(format, args...) \
93 printk(KERN_INFO DRV_NAME": " format, ## args)
94#define lbs_pr_err(format, args...) \
95 printk(KERN_ERR DRV_NAME": " format, ## args)
96#define lbs_pr_alert(format, args...) \
97 printk(KERN_ALERT DRV_NAME": " format, ## args)
98
99#ifdef DEBUG 92#ifdef DEBUG
100static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) 93static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len)
101{ 94{
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 4dfd48fe8b6e..63ed5798365c 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -21,6 +21,8 @@
21 21
22*/ 22*/
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/module.h> 26#include <linux/module.h>
25#include <linux/slab.h> 27#include <linux/slab.h>
26#include <linux/delay.h> 28#include <linux/delay.h>
@@ -362,7 +364,7 @@ static int if_cs_send_cmd(struct lbs_private *priv, u8 *buf, u16 nb)
362 if (status & IF_CS_BIT_COMMAND) 364 if (status & IF_CS_BIT_COMMAND)
363 break; 365 break;
364 if (++loops > 100) { 366 if (++loops > 100) {
365 lbs_pr_err("card not ready for commands\n"); 367 netdev_err(priv->dev, "card not ready for commands\n");
366 goto done; 368 goto done;
367 } 369 }
368 mdelay(1); 370 mdelay(1);
@@ -432,14 +434,16 @@ static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len)
432 /* is hardware ready? */ 434 /* is hardware ready? */
433 status = if_cs_read16(priv->card, IF_CS_CARD_STATUS); 435 status = if_cs_read16(priv->card, IF_CS_CARD_STATUS);
434 if ((status & IF_CS_BIT_RESP) == 0) { 436 if ((status & IF_CS_BIT_RESP) == 0) {
435 lbs_pr_err("no cmd response in card\n"); 437 netdev_err(priv->dev, "no cmd response in card\n");
436 *len = 0; 438 *len = 0;
437 goto out; 439 goto out;
438 } 440 }
439 441
440 *len = if_cs_read16(priv->card, IF_CS_RESP_LEN); 442 *len = if_cs_read16(priv->card, IF_CS_RESP_LEN);
441 if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) { 443 if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) {
442 lbs_pr_err("card cmd buffer has invalid # of bytes (%d)\n", *len); 444 netdev_err(priv->dev,
445 "card cmd buffer has invalid # of bytes (%d)\n",
446 *len);
443 goto out; 447 goto out;
444 } 448 }
445 449
@@ -473,7 +477,9 @@ static struct sk_buff *if_cs_receive_data(struct lbs_private *priv)
473 477
474 len = if_cs_read16(priv->card, IF_CS_READ_LEN); 478 len = if_cs_read16(priv->card, IF_CS_READ_LEN);
475 if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { 479 if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
476 lbs_pr_err("card data buffer has invalid # of bytes (%d)\n", len); 480 netdev_err(priv->dev,
481 "card data buffer has invalid # of bytes (%d)\n",
482 len);
477 priv->dev->stats.rx_dropped++; 483 priv->dev->stats.rx_dropped++;
478 goto dat_err; 484 goto dat_err;
479 } 485 }
@@ -653,8 +659,8 @@ static int if_cs_prog_helper(struct if_cs_card *card, const struct firmware *fw)
653 ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS, 659 ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS,
654 IF_CS_BIT_COMMAND); 660 IF_CS_BIT_COMMAND);
655 if (ret < 0) { 661 if (ret < 0) {
656 lbs_pr_err("can't download helper at 0x%x, ret %d\n", 662 pr_err("can't download helper at 0x%x, ret %d\n",
657 sent, ret); 663 sent, ret);
658 goto done; 664 goto done;
659 } 665 }
660 666
@@ -684,7 +690,7 @@ static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw)
684 ret = if_cs_poll_while_fw_download(card, IF_CS_SQ_READ_LOW, 690 ret = if_cs_poll_while_fw_download(card, IF_CS_SQ_READ_LOW,
685 IF_CS_SQ_HELPER_OK); 691 IF_CS_SQ_HELPER_OK);
686 if (ret < 0) { 692 if (ret < 0) {
687 lbs_pr_err("helper firmware doesn't answer\n"); 693 pr_err("helper firmware doesn't answer\n");
688 goto done; 694 goto done;
689 } 695 }
690 696
@@ -692,13 +698,13 @@ static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw)
692 len = if_cs_read16(card, IF_CS_SQ_READ_LOW); 698 len = if_cs_read16(card, IF_CS_SQ_READ_LOW);
693 if (len & 1) { 699 if (len & 1) {
694 retry++; 700 retry++;
695 lbs_pr_info("odd, need to retry this firmware block\n"); 701 pr_info("odd, need to retry this firmware block\n");
696 } else { 702 } else {
697 retry = 0; 703 retry = 0;
698 } 704 }
699 705
700 if (retry > 20) { 706 if (retry > 20) {
701 lbs_pr_err("could not download firmware\n"); 707 pr_err("could not download firmware\n");
702 ret = -ENODEV; 708 ret = -ENODEV;
703 goto done; 709 goto done;
704 } 710 }
@@ -718,14 +724,14 @@ static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw)
718 ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS, 724 ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS,
719 IF_CS_BIT_COMMAND); 725 IF_CS_BIT_COMMAND);
720 if (ret < 0) { 726 if (ret < 0) {
721 lbs_pr_err("can't download firmware at 0x%x\n", sent); 727 pr_err("can't download firmware at 0x%x\n", sent);
722 goto done; 728 goto done;
723 } 729 }
724 } 730 }
725 731
726 ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); 732 ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a);
727 if (ret < 0) 733 if (ret < 0)
728 lbs_pr_err("firmware download failed\n"); 734 pr_err("firmware download failed\n");
729 735
730done: 736done:
731 lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); 737 lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
@@ -759,7 +765,8 @@ static int if_cs_host_to_card(struct lbs_private *priv,
759 ret = if_cs_send_cmd(priv, buf, nb); 765 ret = if_cs_send_cmd(priv, buf, nb);
760 break; 766 break;
761 default: 767 default:
762 lbs_pr_err("%s: unsupported type %d\n", __func__, type); 768 netdev_err(priv->dev, "%s: unsupported type %d\n",
769 __func__, type);
763 } 770 }
764 771
765 lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); 772 lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
@@ -788,7 +795,7 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
788 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 795 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
789 796
790 if (p_dev->resource[1]->end) { 797 if (p_dev->resource[1]->end) {
791 lbs_pr_err("wrong CIS (check number of IO windows)\n"); 798 pr_err("wrong CIS (check number of IO windows)\n");
792 return -ENODEV; 799 return -ENODEV;
793 } 800 }
794 801
@@ -809,7 +816,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
809 816
810 card = kzalloc(sizeof(struct if_cs_card), GFP_KERNEL); 817 card = kzalloc(sizeof(struct if_cs_card), GFP_KERNEL);
811 if (!card) { 818 if (!card) {
812 lbs_pr_err("error in kzalloc\n"); 819 pr_err("error in kzalloc\n");
813 goto out; 820 goto out;
814 } 821 }
815 card->p_dev = p_dev; 822 card->p_dev = p_dev;
@@ -818,7 +825,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
818 p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 825 p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
819 826
820 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { 827 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) {
821 lbs_pr_err("error in pcmcia_loop_config\n"); 828 pr_err("error in pcmcia_loop_config\n");
822 goto out1; 829 goto out1;
823 } 830 }
824 831
@@ -834,14 +841,14 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
834 card->iobase = ioport_map(p_dev->resource[0]->start, 841 card->iobase = ioport_map(p_dev->resource[0]->start,
835 resource_size(p_dev->resource[0])); 842 resource_size(p_dev->resource[0]));
836 if (!card->iobase) { 843 if (!card->iobase) {
837 lbs_pr_err("error in ioport_map\n"); 844 pr_err("error in ioport_map\n");
838 ret = -EIO; 845 ret = -EIO;
839 goto out1; 846 goto out1;
840 } 847 }
841 848
842 ret = pcmcia_enable_device(p_dev); 849 ret = pcmcia_enable_device(p_dev);
843 if (ret) { 850 if (ret) {
844 lbs_pr_err("error in pcmcia_enable_device\n"); 851 pr_err("error in pcmcia_enable_device\n");
845 goto out2; 852 goto out2;
846 } 853 }
847 854
@@ -856,8 +863,8 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
856 863
857 card->model = get_model(p_dev->manf_id, p_dev->card_id); 864 card->model = get_model(p_dev->manf_id, p_dev->card_id);
858 if (card->model == MODEL_UNKNOWN) { 865 if (card->model == MODEL_UNKNOWN) {
859 lbs_pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n", 866 pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n",
860 p_dev->manf_id, p_dev->card_id); 867 p_dev->manf_id, p_dev->card_id);
861 goto out2; 868 goto out2;
862 } 869 }
863 870
@@ -866,20 +873,20 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
866 if (card->model == MODEL_8305) { 873 if (card->model == MODEL_8305) {
867 card->align_regs = 1; 874 card->align_regs = 1;
868 if (prod_id < IF_CS_CF8305_B1_REV) { 875 if (prod_id < IF_CS_CF8305_B1_REV) {
869 lbs_pr_err("8305 rev B0 and older are not supported\n"); 876 pr_err("8305 rev B0 and older are not supported\n");
870 ret = -ENODEV; 877 ret = -ENODEV;
871 goto out2; 878 goto out2;
872 } 879 }
873 } 880 }
874 881
875 if ((card->model == MODEL_8381) && prod_id < IF_CS_CF8381_B3_REV) { 882 if ((card->model == MODEL_8381) && prod_id < IF_CS_CF8381_B3_REV) {
876 lbs_pr_err("8381 rev B2 and older are not supported\n"); 883 pr_err("8381 rev B2 and older are not supported\n");
877 ret = -ENODEV; 884 ret = -ENODEV;
878 goto out2; 885 goto out2;
879 } 886 }
880 887
881 if ((card->model == MODEL_8385) && prod_id < IF_CS_CF8385_B1_REV) { 888 if ((card->model == MODEL_8385) && prod_id < IF_CS_CF8385_B1_REV) {
882 lbs_pr_err("8385 rev B0 and older are not supported\n"); 889 pr_err("8385 rev B0 and older are not supported\n");
883 ret = -ENODEV; 890 ret = -ENODEV;
884 goto out2; 891 goto out2;
885 } 892 }
@@ -887,7 +894,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
887 ret = lbs_get_firmware(&p_dev->dev, NULL, NULL, card->model, 894 ret = lbs_get_firmware(&p_dev->dev, NULL, NULL, card->model,
888 &fw_table[0], &helper, &mainfw); 895 &fw_table[0], &helper, &mainfw);
889 if (ret) { 896 if (ret) {
890 lbs_pr_err("failed to find firmware (%d)\n", ret); 897 pr_err("failed to find firmware (%d)\n", ret);
891 goto out2; 898 goto out2;
892 } 899 }
893 900
@@ -918,7 +925,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
918 ret = request_irq(p_dev->irq, if_cs_interrupt, 925 ret = request_irq(p_dev->irq, if_cs_interrupt,
919 IRQF_SHARED, DRV_NAME, card); 926 IRQF_SHARED, DRV_NAME, card);
920 if (ret) { 927 if (ret) {
921 lbs_pr_err("error in request_irq\n"); 928 pr_err("error in request_irq\n");
922 goto out3; 929 goto out3;
923 } 930 }
924 931
@@ -931,7 +938,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
931 938
932 /* And finally bring the card up */ 939 /* And finally bring the card up */
933 if (lbs_start_card(priv) != 0) { 940 if (lbs_start_card(priv) != 0) {
934 lbs_pr_err("could not activate card\n"); 941 pr_err("could not activate card\n");
935 goto out3; 942 goto out3;
936 } 943 }
937 944
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index b4de0ca10feb..a7b5cb0c2753 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -26,6 +26,8 @@
26 * if_sdio_card_to_host() to pad the data. 26 * if_sdio_card_to_host() to pad the data.
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/kernel.h> 31#include <linux/kernel.h>
30#include <linux/moduleparam.h> 32#include <linux/moduleparam.h>
31#include <linux/slab.h> 33#include <linux/slab.h>
@@ -409,7 +411,7 @@ static int if_sdio_card_to_host(struct if_sdio_card *card)
409 411
410out: 412out:
411 if (ret) 413 if (ret)
412 lbs_pr_err("problem fetching packet from firmware\n"); 414 pr_err("problem fetching packet from firmware\n");
413 415
414 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); 416 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
415 417
@@ -446,7 +448,7 @@ static void if_sdio_host_to_card_worker(struct work_struct *work)
446 } 448 }
447 449
448 if (ret) 450 if (ret)
449 lbs_pr_err("error %d sending packet to firmware\n", ret); 451 pr_err("error %d sending packet to firmware\n", ret);
450 452
451 sdio_release_host(card->func); 453 sdio_release_host(card->func);
452 454
@@ -555,7 +557,7 @@ release:
555 557
556out: 558out:
557 if (ret) 559 if (ret)
558 lbs_pr_err("failed to load helper firmware\n"); 560 pr_err("failed to load helper firmware\n");
559 561
560 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); 562 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
561 return ret; 563 return ret;
@@ -669,7 +671,7 @@ release:
669 671
670out: 672out:
671 if (ret) 673 if (ret)
672 lbs_pr_err("failed to load firmware\n"); 674 pr_err("failed to load firmware\n");
673 675
674 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); 676 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
675 return ret; 677 return ret;
@@ -723,7 +725,7 @@ static int if_sdio_prog_firmware(struct if_sdio_card *card)
723 ret = lbs_get_firmware(&card->func->dev, lbs_helper_name, lbs_fw_name, 725 ret = lbs_get_firmware(&card->func->dev, lbs_helper_name, lbs_fw_name,
724 card->model, &fw_table[0], &helper, &mainfw); 726 card->model, &fw_table[0], &helper, &mainfw);
725 if (ret) { 727 if (ret) {
726 lbs_pr_err("failed to find firmware (%d)\n", ret); 728 pr_err("failed to find firmware (%d)\n", ret);
727 goto out; 729 goto out;
728 } 730 }
729 731
@@ -849,7 +851,7 @@ static int if_sdio_enter_deep_sleep(struct lbs_private *priv)
849 ret = __lbs_cmd(priv, CMD_802_11_DEEP_SLEEP, &cmd, sizeof(cmd), 851 ret = __lbs_cmd(priv, CMD_802_11_DEEP_SLEEP, &cmd, sizeof(cmd),
850 lbs_cmd_copyback, (unsigned long) &cmd); 852 lbs_cmd_copyback, (unsigned long) &cmd);
851 if (ret) 853 if (ret)
852 lbs_pr_err("DEEP_SLEEP cmd failed\n"); 854 netdev_err(priv->dev, "DEEP_SLEEP cmd failed\n");
853 855
854 mdelay(200); 856 mdelay(200);
855 return ret; 857 return ret;
@@ -865,7 +867,7 @@ static int if_sdio_exit_deep_sleep(struct lbs_private *priv)
865 867
866 sdio_writeb(card->func, HOST_POWER_UP, CONFIGURATION_REG, &ret); 868 sdio_writeb(card->func, HOST_POWER_UP, CONFIGURATION_REG, &ret);
867 if (ret) 869 if (ret)
868 lbs_pr_err("sdio_writeb failed!\n"); 870 netdev_err(priv->dev, "sdio_writeb failed!\n");
869 871
870 sdio_release_host(card->func); 872 sdio_release_host(card->func);
871 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); 873 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
@@ -882,7 +884,7 @@ static int if_sdio_reset_deep_sleep_wakeup(struct lbs_private *priv)
882 884
883 sdio_writeb(card->func, 0, CONFIGURATION_REG, &ret); 885 sdio_writeb(card->func, 0, CONFIGURATION_REG, &ret);
884 if (ret) 886 if (ret)
885 lbs_pr_err("sdio_writeb failed!\n"); 887 netdev_err(priv->dev, "sdio_writeb failed!\n");
886 888
887 sdio_release_host(card->func); 889 sdio_release_host(card->func);
888 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); 890 lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
@@ -961,7 +963,7 @@ static int if_sdio_probe(struct sdio_func *func,
961 } 963 }
962 964
963 if (i == func->card->num_info) { 965 if (i == func->card->num_info) {
964 lbs_pr_err("unable to identify card model\n"); 966 pr_err("unable to identify card model\n");
965 return -ENODEV; 967 return -ENODEV;
966 } 968 }
967 969
@@ -995,7 +997,7 @@ static int if_sdio_probe(struct sdio_func *func,
995 break; 997 break;
996 } 998 }
997 if (i == ARRAY_SIZE(fw_table)) { 999 if (i == ARRAY_SIZE(fw_table)) {
998 lbs_pr_err("unknown card model 0x%x\n", card->model); 1000 pr_err("unknown card model 0x%x\n", card->model);
999 ret = -ENODEV; 1001 ret = -ENODEV;
1000 goto free; 1002 goto free;
1001 } 1003 }
@@ -1101,7 +1103,7 @@ static int if_sdio_probe(struct sdio_func *func,
1101 lbs_deb_sdio("send function INIT command\n"); 1103 lbs_deb_sdio("send function INIT command\n");
1102 if (__lbs_cmd(priv, CMD_FUNC_INIT, &cmd, sizeof(cmd), 1104 if (__lbs_cmd(priv, CMD_FUNC_INIT, &cmd, sizeof(cmd),
1103 lbs_cmd_copyback, (unsigned long) &cmd)) 1105 lbs_cmd_copyback, (unsigned long) &cmd))
1104 lbs_pr_alert("CMD_FUNC_INIT cmd failed\n"); 1106 netdev_alert(priv->dev, "CMD_FUNC_INIT cmd failed\n");
1105 } 1107 }
1106 1108
1107 ret = lbs_start_card(priv); 1109 ret = lbs_start_card(priv);
@@ -1163,7 +1165,7 @@ static void if_sdio_remove(struct sdio_func *func)
1163 if (__lbs_cmd(card->priv, CMD_FUNC_SHUTDOWN, 1165 if (__lbs_cmd(card->priv, CMD_FUNC_SHUTDOWN,
1164 &cmd, sizeof(cmd), lbs_cmd_copyback, 1166 &cmd, sizeof(cmd), lbs_cmd_copyback,
1165 (unsigned long) &cmd)) 1167 (unsigned long) &cmd))
1166 lbs_pr_alert("CMD_FUNC_SHUTDOWN cmd failed\n"); 1168 pr_alert("CMD_FUNC_SHUTDOWN cmd failed\n");
1167 } 1169 }
1168 1170
1169 1171
@@ -1202,20 +1204,19 @@ static int if_sdio_suspend(struct device *dev)
1202 1204
1203 mmc_pm_flag_t flags = sdio_get_host_pm_caps(func); 1205 mmc_pm_flag_t flags = sdio_get_host_pm_caps(func);
1204 1206
1205 lbs_pr_info("%s: suspend: PM flags = 0x%x\n", 1207 dev_info(dev, "%s: suspend: PM flags = 0x%x\n",
1206 sdio_func_id(func), flags); 1208 sdio_func_id(func), flags);
1207 1209
1208 /* If we aren't being asked to wake on anything, we should bail out 1210 /* If we aren't being asked to wake on anything, we should bail out
1209 * and let the SD stack power down the card. 1211 * and let the SD stack power down the card.
1210 */ 1212 */
1211 if (card->priv->wol_criteria == EHS_REMOVE_WAKEUP) { 1213 if (card->priv->wol_criteria == EHS_REMOVE_WAKEUP) {
1212 lbs_pr_info("Suspend without wake params -- " 1214 dev_info(dev, "Suspend without wake params -- powering down card\n");
1213 "powering down card.");
1214 return -ENOSYS; 1215 return -ENOSYS;
1215 } 1216 }
1216 1217
1217 if (!(flags & MMC_PM_KEEP_POWER)) { 1218 if (!(flags & MMC_PM_KEEP_POWER)) {
1218 lbs_pr_err("%s: cannot remain alive while host is suspended\n", 1219 dev_err(dev, "%s: cannot remain alive while host is suspended\n",
1219 sdio_func_id(func)); 1220 sdio_func_id(func));
1220 return -ENOSYS; 1221 return -ENOSYS;
1221 } 1222 }
@@ -1237,7 +1238,7 @@ static int if_sdio_resume(struct device *dev)
1237 struct if_sdio_card *card = sdio_get_drvdata(func); 1238 struct if_sdio_card *card = sdio_get_drvdata(func);
1238 int ret; 1239 int ret;
1239 1240
1240 lbs_pr_info("%s: resume: we're back\n", sdio_func_id(func)); 1241 dev_info(dev, "%s: resume: we're back\n", sdio_func_id(func));
1241 1242
1242 ret = lbs_resume(card->priv); 1243 ret = lbs_resume(card->priv);
1243 1244
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 67de5b3c68b2..463352c890d7 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -17,6 +17,8 @@
17 * (at your option) any later version. 17 * (at your option) any later version.
18 */ 18 */
19 19
20#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
21
20#include <linux/moduleparam.h> 22#include <linux/moduleparam.h>
21#include <linux/firmware.h> 23#include <linux/firmware.h>
22#include <linux/jiffies.h> 24#include <linux/jiffies.h>
@@ -305,8 +307,7 @@ static int spu_wait_for_u16(struct if_spi_card *card, u16 reg,
305 } 307 }
306 udelay(100); 308 udelay(100);
307 if (time_after(jiffies, timeout)) { 309 if (time_after(jiffies, timeout)) {
308 lbs_pr_err("%s: timeout with val=%02x, " 310 pr_err("%s: timeout with val=%02x, target_mask=%02x, target=%02x\n",
309 "target_mask=%02x, target=%02x\n",
310 __func__, val, target_mask, target); 311 __func__, val, target_mask, target);
311 return -ETIMEDOUT; 312 return -ETIMEDOUT;
312 } 313 }
@@ -405,7 +406,7 @@ static int spu_set_bus_mode(struct if_spi_card *card, u16 mode)
405 if (err) 406 if (err)
406 return err; 407 return err;
407 if ((rval & 0xF) != mode) { 408 if ((rval & 0xF) != mode) {
408 lbs_pr_err("Can't read bus mode register.\n"); 409 pr_err("Can't read bus mode register\n");
409 return -EIO; 410 return -EIO;
410 } 411 }
411 return 0; 412 return 0;
@@ -534,7 +535,7 @@ static int if_spi_prog_helper_firmware(struct if_spi_card *card,
534 535
535out: 536out:
536 if (err) 537 if (err)
537 lbs_pr_err("failed to load helper firmware (err=%d)\n", err); 538 pr_err("failed to load helper firmware (err=%d)\n", err);
538 lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err); 539 lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err);
539 return err; 540 return err;
540} 541}
@@ -557,7 +558,7 @@ static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card,
557 IF_SPI_HIST_CMD_DOWNLOAD_RDY, 558 IF_SPI_HIST_CMD_DOWNLOAD_RDY,
558 IF_SPI_HIST_CMD_DOWNLOAD_RDY); 559 IF_SPI_HIST_CMD_DOWNLOAD_RDY);
559 if (err) { 560 if (err) {
560 lbs_pr_err("timed out waiting for host_int_status\n"); 561 pr_err("timed out waiting for host_int_status\n");
561 return err; 562 return err;
562 } 563 }
563 564
@@ -567,9 +568,8 @@ static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card,
567 return err; 568 return err;
568 569
569 if (len > IF_SPI_CMD_BUF_SIZE) { 570 if (len > IF_SPI_CMD_BUF_SIZE) {
570 lbs_pr_err("firmware load device requested a larger " 571 pr_err("firmware load device requested a larger transfer than we are prepared to handle (len = %d)\n",
571 "tranfer than we are prepared to " 572 len);
572 "handle. (len = %d)\n", len);
573 return -EIO; 573 return -EIO;
574 } 574 }
575 if (len & 0x1) { 575 if (len & 0x1) {
@@ -585,6 +585,7 @@ static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card,
585static int if_spi_prog_main_firmware(struct if_spi_card *card, 585static int if_spi_prog_main_firmware(struct if_spi_card *card,
586 const struct firmware *firmware) 586 const struct firmware *firmware)
587{ 587{
588 struct lbs_private *priv = card->priv;
588 int len, prev_len; 589 int len, prev_len;
589 int bytes, crc_err = 0, err = 0; 590 int bytes, crc_err = 0, err = 0;
590 const u8 *fw; 591 const u8 *fw;
@@ -598,8 +599,9 @@ static int if_spi_prog_main_firmware(struct if_spi_card *card,
598 599
599 err = spu_wait_for_u16(card, IF_SPI_SCRATCH_1_REG, 0, 0); 600 err = spu_wait_for_u16(card, IF_SPI_SCRATCH_1_REG, 0, 0);
600 if (err) { 601 if (err) {
601 lbs_pr_err("%s: timed out waiting for initial " 602 netdev_err(priv->dev,
602 "scratch reg = 0\n", __func__); 603 "%s: timed out waiting for initial scratch reg = 0\n",
604 __func__);
603 goto out; 605 goto out;
604 } 606 }
605 607
@@ -617,15 +619,14 @@ static int if_spi_prog_main_firmware(struct if_spi_card *card,
617 * If there are no more bytes left, we would normally 619 * If there are no more bytes left, we would normally
618 * expect to have terminated with len = 0 620 * expect to have terminated with len = 0
619 */ 621 */
620 lbs_pr_err("Firmware load wants more bytes " 622 netdev_err(priv->dev,
621 "than we have to offer.\n"); 623 "Firmware load wants more bytes than we have to offer.\n");
622 break; 624 break;
623 } 625 }
624 if (crc_err) { 626 if (crc_err) {
625 /* Previous transfer failed. */ 627 /* Previous transfer failed. */
626 if (++num_crc_errs > MAX_MAIN_FW_LOAD_CRC_ERR) { 628 if (++num_crc_errs > MAX_MAIN_FW_LOAD_CRC_ERR) {
627 lbs_pr_err("Too many CRC errors encountered " 629 pr_err("Too many CRC errors encountered in firmware load.\n");
628 "in firmware load.\n");
629 err = -EIO; 630 err = -EIO;
630 goto out; 631 goto out;
631 } 632 }
@@ -654,21 +655,20 @@ static int if_spi_prog_main_firmware(struct if_spi_card *card,
654 prev_len = len; 655 prev_len = len;
655 } 656 }
656 if (bytes > prev_len) { 657 if (bytes > prev_len) {
657 lbs_pr_err("firmware load wants fewer bytes than " 658 pr_err("firmware load wants fewer bytes than we have to offer\n");
658 "we have to offer.\n");
659 } 659 }
660 660
661 /* Confirm firmware download */ 661 /* Confirm firmware download */
662 err = spu_wait_for_u32(card, IF_SPI_SCRATCH_4_REG, 662 err = spu_wait_for_u32(card, IF_SPI_SCRATCH_4_REG,
663 SUCCESSFUL_FW_DOWNLOAD_MAGIC); 663 SUCCESSFUL_FW_DOWNLOAD_MAGIC);
664 if (err) { 664 if (err) {
665 lbs_pr_err("failed to confirm the firmware download\n"); 665 pr_err("failed to confirm the firmware download\n");
666 goto out; 666 goto out;
667 } 667 }
668 668
669out: 669out:
670 if (err) 670 if (err)
671 lbs_pr_err("failed to load firmware (err=%d)\n", err); 671 pr_err("failed to load firmware (err=%d)\n", err);
672 lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err); 672 lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err);
673 return err; 673 return err;
674} 674}
@@ -709,13 +709,13 @@ static int if_spi_c2h_cmd(struct if_spi_card *card)
709 if (err) 709 if (err)
710 goto out; 710 goto out;
711 if (!len) { 711 if (!len) {
712 lbs_pr_err("%s: error: card has no data for host\n", 712 netdev_err(priv->dev, "%s: error: card has no data for host\n",
713 __func__); 713 __func__);
714 err = -EINVAL; 714 err = -EINVAL;
715 goto out; 715 goto out;
716 } else if (len > IF_SPI_CMD_BUF_SIZE) { 716 } else if (len > IF_SPI_CMD_BUF_SIZE) {
717 lbs_pr_err("%s: error: response packet too large: " 717 netdev_err(priv->dev,
718 "%d bytes, but maximum is %d\n", 718 "%s: error: response packet too large: %d bytes, but maximum is %d\n",
719 __func__, len, IF_SPI_CMD_BUF_SIZE); 719 __func__, len, IF_SPI_CMD_BUF_SIZE);
720 err = -EINVAL; 720 err = -EINVAL;
721 goto out; 721 goto out;
@@ -737,7 +737,7 @@ static int if_spi_c2h_cmd(struct if_spi_card *card)
737 737
738out: 738out:
739 if (err) 739 if (err)
740 lbs_pr_err("%s: err=%d\n", __func__, err); 740 netdev_err(priv->dev, "%s: err=%d\n", __func__, err);
741 lbs_deb_leave(LBS_DEB_SPI); 741 lbs_deb_leave(LBS_DEB_SPI);
742 return err; 742 return err;
743} 743}
@@ -745,6 +745,7 @@ out:
745/* Move data from the card to the host */ 745/* Move data from the card to the host */
746static int if_spi_c2h_data(struct if_spi_card *card) 746static int if_spi_c2h_data(struct if_spi_card *card)
747{ 747{
748 struct lbs_private *priv = card->priv;
748 struct sk_buff *skb; 749 struct sk_buff *skb;
749 char *data; 750 char *data;
750 u16 len; 751 u16 len;
@@ -757,13 +758,13 @@ static int if_spi_c2h_data(struct if_spi_card *card)
757 if (err) 758 if (err)
758 goto out; 759 goto out;
759 if (!len) { 760 if (!len) {
760 lbs_pr_err("%s: error: card has no data for host\n", 761 netdev_err(priv->dev, "%s: error: card has no data for host\n",
761 __func__); 762 __func__);
762 err = -EINVAL; 763 err = -EINVAL;
763 goto out; 764 goto out;
764 } else if (len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { 765 } else if (len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
765 lbs_pr_err("%s: error: card has %d bytes of data, but " 766 netdev_err(priv->dev,
766 "our maximum skb size is %zu\n", 767 "%s: error: card has %d bytes of data, but our maximum skb size is %zu\n",
767 __func__, len, MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); 768 __func__, len, MRVDRV_ETH_RX_PACKET_BUFFER_SIZE);
768 err = -EINVAL; 769 err = -EINVAL;
769 goto out; 770 goto out;
@@ -795,7 +796,7 @@ free_skb:
795 dev_kfree_skb(skb); 796 dev_kfree_skb(skb);
796out: 797out:
797 if (err) 798 if (err)
798 lbs_pr_err("%s: err=%d\n", __func__, err); 799 netdev_err(priv->dev, "%s: err=%d\n", __func__, err);
799 lbs_deb_leave(LBS_DEB_SPI); 800 lbs_deb_leave(LBS_DEB_SPI);
800 return err; 801 return err;
801} 802}
@@ -804,6 +805,7 @@ out:
804static void if_spi_h2c(struct if_spi_card *card, 805static void if_spi_h2c(struct if_spi_card *card,
805 struct if_spi_packet *packet, int type) 806 struct if_spi_packet *packet, int type)
806{ 807{
808 struct lbs_private *priv = card->priv;
807 int err = 0; 809 int err = 0;
808 u16 int_type, port_reg; 810 u16 int_type, port_reg;
809 811
@@ -817,7 +819,8 @@ static void if_spi_h2c(struct if_spi_card *card,
817 port_reg = IF_SPI_CMD_RDWRPORT_REG; 819 port_reg = IF_SPI_CMD_RDWRPORT_REG;
818 break; 820 break;
819 default: 821 default:
820 lbs_pr_err("can't transfer buffer of type %d\n", type); 822 netdev_err(priv->dev, "can't transfer buffer of type %d\n",
823 type);
821 err = -EINVAL; 824 err = -EINVAL;
822 goto out; 825 goto out;
823 } 826 }
@@ -831,7 +834,7 @@ out:
831 kfree(packet); 834 kfree(packet);
832 835
833 if (err) 836 if (err)
834 lbs_pr_err("%s: error %d\n", __func__, err); 837 netdev_err(priv->dev, "%s: error %d\n", __func__, err);
835} 838}
836 839
837/* Inform the host about a card event */ 840/* Inform the host about a card event */
@@ -855,7 +858,7 @@ static void if_spi_e2h(struct if_spi_card *card)
855 lbs_queue_event(priv, cause & 0xff); 858 lbs_queue_event(priv, cause & 0xff);
856out: 859out:
857 if (err) 860 if (err)
858 lbs_pr_err("%s: error %d\n", __func__, err); 861 netdev_err(priv->dev, "%s: error %d\n", __func__, err);
859} 862}
860 863
861static void if_spi_host_to_card_worker(struct work_struct *work) 864static void if_spi_host_to_card_worker(struct work_struct *work)
@@ -865,8 +868,10 @@ static void if_spi_host_to_card_worker(struct work_struct *work)
865 u16 hiStatus; 868 u16 hiStatus;
866 unsigned long flags; 869 unsigned long flags;
867 struct if_spi_packet *packet; 870 struct if_spi_packet *packet;
871 struct lbs_private *priv;
868 872
869 card = container_of(work, struct if_spi_card, packet_work); 873 card = container_of(work, struct if_spi_card, packet_work);
874 priv = card->priv;
870 875
871 lbs_deb_enter(LBS_DEB_SPI); 876 lbs_deb_enter(LBS_DEB_SPI);
872 877
@@ -877,7 +882,7 @@ static void if_spi_host_to_card_worker(struct work_struct *work)
877 err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG, 882 err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG,
878 &hiStatus); 883 &hiStatus);
879 if (err) { 884 if (err) {
880 lbs_pr_err("I/O error\n"); 885 netdev_err(priv->dev, "I/O error\n");
881 goto err; 886 goto err;
882 } 887 }
883 888
@@ -940,7 +945,7 @@ static void if_spi_host_to_card_worker(struct work_struct *work)
940 945
941err: 946err:
942 if (err) 947 if (err)
943 lbs_pr_err("%s: got error %d\n", __func__, err); 948 netdev_err(priv->dev, "%s: got error %d\n", __func__, err);
944 949
945 lbs_deb_leave(LBS_DEB_SPI); 950 lbs_deb_leave(LBS_DEB_SPI);
946} 951}
@@ -963,7 +968,8 @@ static int if_spi_host_to_card(struct lbs_private *priv,
963 lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb); 968 lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb);
964 969
965 if (nb == 0) { 970 if (nb == 0) {
966 lbs_pr_err("%s: invalid size requested: %d\n", __func__, nb); 971 netdev_err(priv->dev, "%s: invalid size requested: %d\n",
972 __func__, nb);
967 err = -EINVAL; 973 err = -EINVAL;
968 goto out; 974 goto out;
969 } 975 }
@@ -991,7 +997,8 @@ static int if_spi_host_to_card(struct lbs_private *priv,
991 spin_unlock_irqrestore(&card->buffer_lock, flags); 997 spin_unlock_irqrestore(&card->buffer_lock, flags);
992 break; 998 break;
993 default: 999 default:
994 lbs_pr_err("can't transfer buffer of type %d", type); 1000 netdev_err(priv->dev, "can't transfer buffer of type %d\n",
1001 type);
995 err = -EINVAL; 1002 err = -EINVAL;
996 break; 1003 break;
997 } 1004 }
@@ -1024,6 +1031,7 @@ static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id)
1024 1031
1025static int if_spi_init_card(struct if_spi_card *card) 1032static int if_spi_init_card(struct if_spi_card *card)
1026{ 1033{
1034 struct lbs_private *priv = card->priv;
1027 struct spi_device *spi = card->spi; 1035 struct spi_device *spi = card->spi;
1028 int err, i; 1036 int err, i;
1029 u32 scratch; 1037 u32 scratch;
@@ -1052,8 +1060,8 @@ static int if_spi_init_card(struct if_spi_card *card)
1052 break; 1060 break;
1053 } 1061 }
1054 if (i == ARRAY_SIZE(fw_table)) { 1062 if (i == ARRAY_SIZE(fw_table)) {
1055 lbs_pr_err("Unsupported chip_id: 0x%02x\n", 1063 netdev_err(priv->dev, "Unsupported chip_id: 0x%02x\n",
1056 card->card_id); 1064 card->card_id);
1057 err = -ENODEV; 1065 err = -ENODEV;
1058 goto out; 1066 goto out;
1059 } 1067 }
@@ -1062,7 +1070,8 @@ static int if_spi_init_card(struct if_spi_card *card)
1062 card->card_id, &fw_table[0], &helper, 1070 card->card_id, &fw_table[0], &helper,
1063 &mainfw); 1071 &mainfw);
1064 if (err) { 1072 if (err) {
1065 lbs_pr_err("failed to find firmware (%d)\n", err); 1073 netdev_err(priv->dev, "failed to find firmware (%d)\n",
1074 err);
1066 goto out; 1075 goto out;
1067 } 1076 }
1068 1077
@@ -1187,7 +1196,7 @@ static int __devinit if_spi_probe(struct spi_device *spi)
1187 err = request_irq(spi->irq, if_spi_host_interrupt, 1196 err = request_irq(spi->irq, if_spi_host_interrupt,
1188 IRQF_TRIGGER_FALLING, "libertas_spi", card); 1197 IRQF_TRIGGER_FALLING, "libertas_spi", card);
1189 if (err) { 1198 if (err) {
1190 lbs_pr_err("can't get host irq line-- request_irq failed\n"); 1199 pr_err("can't get host irq line-- request_irq failed\n");
1191 goto terminate_workqueue; 1200 goto terminate_workqueue;
1192 } 1201 }
1193 1202
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index e1e2128f4113..b5acc393a65a 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -1,6 +1,9 @@
1/* 1/*
2 * This file contains functions used in USB interface module. 2 * This file contains functions used in USB interface module.
3 */ 3 */
4
5#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6
4#include <linux/delay.h> 7#include <linux/delay.h>
5#include <linux/moduleparam.h> 8#include <linux/moduleparam.h>
6#include <linux/firmware.h> 9#include <linux/firmware.h>
@@ -153,7 +156,7 @@ static void if_usb_write_bulk_callback(struct urb *urb)
153 lbs_host_to_card_done(priv); 156 lbs_host_to_card_done(priv);
154 } else { 157 } else {
155 /* print the failure status number for debug */ 158 /* print the failure status number for debug */
156 lbs_pr_info("URB in failure status: %d\n", urb->status); 159 pr_info("URB in failure status: %d\n", urb->status);
157 } 160 }
158} 161}
159 162
@@ -203,7 +206,7 @@ static void if_usb_setup_firmware(struct lbs_private *priv)
203 wake_method.hdr.size = cpu_to_le16(sizeof(wake_method)); 206 wake_method.hdr.size = cpu_to_le16(sizeof(wake_method));
204 wake_method.action = cpu_to_le16(CMD_ACT_GET); 207 wake_method.action = cpu_to_le16(CMD_ACT_GET);
205 if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) { 208 if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) {
206 lbs_pr_info("Firmware does not seem to support PS mode\n"); 209 netdev_info(priv->dev, "Firmware does not seem to support PS mode\n");
207 priv->fwcapinfo &= ~FW_CAPINFO_PS; 210 priv->fwcapinfo &= ~FW_CAPINFO_PS;
208 } else { 211 } else {
209 if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) { 212 if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) {
@@ -212,7 +215,8 @@ static void if_usb_setup_firmware(struct lbs_private *priv)
212 /* The versions which boot up this way don't seem to 215 /* The versions which boot up this way don't seem to
213 work even if we set it to the command interrupt */ 216 work even if we set it to the command interrupt */
214 priv->fwcapinfo &= ~FW_CAPINFO_PS; 217 priv->fwcapinfo &= ~FW_CAPINFO_PS;
215 lbs_pr_info("Firmware doesn't wake via command interrupt; disabling PS mode\n"); 218 netdev_info(priv->dev,
219 "Firmware doesn't wake via command interrupt; disabling PS mode\n");
216 } 220 }
217 } 221 }
218} 222}
@@ -224,7 +228,7 @@ static void if_usb_fw_timeo(unsigned long priv)
224 if (cardp->fwdnldover) { 228 if (cardp->fwdnldover) {
225 lbs_deb_usb("Download complete, no event. Assuming success\n"); 229 lbs_deb_usb("Download complete, no event. Assuming success\n");
226 } else { 230 } else {
227 lbs_pr_err("Download timed out\n"); 231 pr_err("Download timed out\n");
228 cardp->surprise_removed = 1; 232 cardp->surprise_removed = 1;
229 } 233 }
230 wake_up(&cardp->fw_wq); 234 wake_up(&cardp->fw_wq);
@@ -258,7 +262,7 @@ static int if_usb_probe(struct usb_interface *intf,
258 262
259 cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); 263 cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL);
260 if (!cardp) { 264 if (!cardp) {
261 lbs_pr_err("Out of memory allocating private data.\n"); 265 pr_err("Out of memory allocating private data\n");
262 goto error; 266 goto error;
263 } 267 }
264 268
@@ -348,10 +352,12 @@ static int if_usb_probe(struct usb_interface *intf,
348 usb_set_intfdata(intf, cardp); 352 usb_set_intfdata(intf, cardp);
349 353
350 if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_fw)) 354 if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_fw))
351 lbs_pr_err("cannot register lbs_flash_fw attribute\n"); 355 netdev_err(priv->dev,
356 "cannot register lbs_flash_fw attribute\n");
352 357
353 if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_boot2)) 358 if (device_create_file(&priv->dev->dev, &dev_attr_lbs_flash_boot2))
354 lbs_pr_err("cannot register lbs_flash_boot2 attribute\n"); 359 netdev_err(priv->dev,
360 "cannot register lbs_flash_boot2 attribute\n");
355 361
356 /* 362 /*
357 * EHS_REMOVE_WAKEUP is not supported on all versions of the firmware. 363 * EHS_REMOVE_WAKEUP is not supported on all versions of the firmware.
@@ -536,7 +542,7 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp,
536 int ret = -1; 542 int ret = -1;
537 543
538 if (!(skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) { 544 if (!(skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) {
539 lbs_pr_err("No free skb\n"); 545 pr_err("No free skb\n");
540 goto rx_ret; 546 goto rx_ret;
541 } 547 }
542 548
@@ -595,7 +601,7 @@ static void if_usb_receive_fwload(struct urb *urb)
595 601
596 if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) && 602 if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) &&
597 tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) { 603 tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) {
598 lbs_pr_info("Firmware ready event received\n"); 604 pr_info("Firmware ready event received\n");
599 wake_up(&cardp->fw_wq); 605 wake_up(&cardp->fw_wq);
600 } else { 606 } else {
601 lbs_deb_usb("Waiting for confirmation; got %x %x\n", 607 lbs_deb_usb("Waiting for confirmation; got %x %x\n",
@@ -622,20 +628,20 @@ static void if_usb_receive_fwload(struct urb *urb)
622 bootcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) || 628 bootcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) ||
623 bootcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) { 629 bootcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) {
624 if (!cardp->bootcmdresp) 630 if (!cardp->bootcmdresp)
625 lbs_pr_info("Firmware already seems alive; resetting\n"); 631 pr_info("Firmware already seems alive; resetting\n");
626 cardp->bootcmdresp = -1; 632 cardp->bootcmdresp = -1;
627 } else { 633 } else {
628 lbs_pr_info("boot cmd response wrong magic number (0x%x)\n", 634 pr_info("boot cmd response wrong magic number (0x%x)\n",
629 le32_to_cpu(bootcmdresp.magic)); 635 le32_to_cpu(bootcmdresp.magic));
630 } 636 }
631 } else if ((bootcmdresp.cmd != BOOT_CMD_FW_BY_USB) && 637 } else if ((bootcmdresp.cmd != BOOT_CMD_FW_BY_USB) &&
632 (bootcmdresp.cmd != BOOT_CMD_UPDATE_FW) && 638 (bootcmdresp.cmd != BOOT_CMD_UPDATE_FW) &&
633 (bootcmdresp.cmd != BOOT_CMD_UPDATE_BOOT2)) { 639 (bootcmdresp.cmd != BOOT_CMD_UPDATE_BOOT2)) {
634 lbs_pr_info("boot cmd response cmd_tag error (%d)\n", 640 pr_info("boot cmd response cmd_tag error (%d)\n",
635 bootcmdresp.cmd); 641 bootcmdresp.cmd);
636 } else if (bootcmdresp.result != BOOT_CMD_RESP_OK) { 642 } else if (bootcmdresp.result != BOOT_CMD_RESP_OK) {
637 lbs_pr_info("boot cmd response result error (%d)\n", 643 pr_info("boot cmd response result error (%d)\n",
638 bootcmdresp.result); 644 bootcmdresp.result);
639 } else { 645 } else {
640 cardp->bootcmdresp = 1; 646 cardp->bootcmdresp = 1;
641 lbs_deb_usbd(&cardp->udev->dev, 647 lbs_deb_usbd(&cardp->udev->dev,
@@ -901,7 +907,7 @@ static int check_fwfile_format(const uint8_t *data, uint32_t totlen)
901 } while (!exit); 907 } while (!exit);
902 908
903 if (ret) 909 if (ret)
904 lbs_pr_err("firmware file format check FAIL\n"); 910 pr_err("firmware file format check FAIL\n");
905 else 911 else
906 lbs_deb_fw("firmware file format check PASS\n"); 912 lbs_deb_fw("firmware file format check PASS\n");
907 913
@@ -998,7 +1004,7 @@ static int __if_usb_prog_firmware(struct if_usb_card *cardp,
998 1004
999 ret = get_fw(cardp, fwname); 1005 ret = get_fw(cardp, fwname);
1000 if (ret) { 1006 if (ret) {
1001 lbs_pr_err("failed to find firmware (%d)\n", ret); 1007 pr_err("failed to find firmware (%d)\n", ret);
1002 goto done; 1008 goto done;
1003 } 1009 }
1004 1010
@@ -1073,13 +1079,13 @@ restart:
1073 usb_kill_urb(cardp->rx_urb); 1079 usb_kill_urb(cardp->rx_urb);
1074 1080
1075 if (!cardp->fwdnldover) { 1081 if (!cardp->fwdnldover) {
1076 lbs_pr_info("failed to load fw, resetting device!\n"); 1082 pr_info("failed to load fw, resetting device!\n");
1077 if (--reset_count >= 0) { 1083 if (--reset_count >= 0) {
1078 if_usb_reset_device(cardp); 1084 if_usb_reset_device(cardp);
1079 goto restart; 1085 goto restart;
1080 } 1086 }
1081 1087
1082 lbs_pr_info("FW download failure, time = %d ms\n", i * 100); 1088 pr_info("FW download failure, time = %d ms\n", i * 100);
1083 ret = -EIO; 1089 ret = -EIO;
1084 goto release_fw; 1090 goto release_fw;
1085 } 1091 }
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index ed57cf863b69..8c40949cb076 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -4,6 +4,8 @@
4 * thread etc.. 4 * thread etc..
5 */ 5 */
6 6
7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8
7#include <linux/moduleparam.h> 9#include <linux/moduleparam.h>
8#include <linux/delay.h> 10#include <linux/delay.h>
9#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
@@ -34,6 +36,10 @@ unsigned int lbs_debug;
34EXPORT_SYMBOL_GPL(lbs_debug); 36EXPORT_SYMBOL_GPL(lbs_debug);
35module_param_named(libertas_debug, lbs_debug, int, 0644); 37module_param_named(libertas_debug, lbs_debug, int, 0644);
36 38
39unsigned int lbs_disablemesh;
40EXPORT_SYMBOL_GPL(lbs_disablemesh);
41module_param_named(libertas_disablemesh, lbs_disablemesh, int, 0644);
42
37 43
38/* 44/*
39 * This global structure is used to send the confirm_sleep command as 45 * This global structure is used to send the confirm_sleep command as
@@ -149,28 +155,6 @@ static int lbs_eth_stop(struct net_device *dev)
149 return 0; 155 return 0;
150} 156}
151 157
152static void lbs_tx_timeout(struct net_device *dev)
153{
154 struct lbs_private *priv = dev->ml_priv;
155
156 lbs_deb_enter(LBS_DEB_TX);
157
158 lbs_pr_err("tx watch dog timeout\n");
159
160 dev->trans_start = jiffies; /* prevent tx timeout */
161
162 if (priv->currenttxskb)
163 lbs_send_tx_feedback(priv, 0);
164
165 /* XX: Shouldn't we also call into the hw-specific driver
166 to kick it somehow? */
167 lbs_host_to_card_done(priv);
168
169 /* FIXME: reset the card */
170
171 lbs_deb_leave(LBS_DEB_TX);
172}
173
174void lbs_host_to_card_done(struct lbs_private *priv) 158void lbs_host_to_card_done(struct lbs_private *priv)
175{ 159{
176 unsigned long flags; 160 unsigned long flags;
@@ -464,8 +448,8 @@ static int lbs_thread(void *data)
464 if (priv->cmd_timed_out && priv->cur_cmd) { 448 if (priv->cmd_timed_out && priv->cur_cmd) {
465 struct cmd_ctrl_node *cmdnode = priv->cur_cmd; 449 struct cmd_ctrl_node *cmdnode = priv->cur_cmd;
466 450
467 lbs_pr_info("Timeout submitting command 0x%04x\n", 451 netdev_info(dev, "Timeout submitting command 0x%04x\n",
468 le16_to_cpu(cmdnode->cmdbuf->command)); 452 le16_to_cpu(cmdnode->cmdbuf->command));
469 lbs_complete_command(priv, cmdnode, -ETIMEDOUT); 453 lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
470 if (priv->reset_card) 454 if (priv->reset_card)
471 priv->reset_card(priv); 455 priv->reset_card(priv);
@@ -492,8 +476,8 @@ static int lbs_thread(void *data)
492 * after firmware fixes it 476 * after firmware fixes it
493 */ 477 */
494 priv->psstate = PS_STATE_AWAKE; 478 priv->psstate = PS_STATE_AWAKE;
495 lbs_pr_alert("ignore PS_SleepConfirm in " 479 netdev_alert(dev,
496 "non-connected state\n"); 480 "ignore PS_SleepConfirm in non-connected state\n");
497 } 481 }
498 } 482 }
499 483
@@ -587,7 +571,8 @@ int lbs_suspend(struct lbs_private *priv)
587 if (priv->is_deep_sleep) { 571 if (priv->is_deep_sleep) {
588 ret = lbs_set_deep_sleep(priv, 0); 572 ret = lbs_set_deep_sleep(priv, 0);
589 if (ret) { 573 if (ret) {
590 lbs_pr_err("deep sleep cancellation failed: %d\n", ret); 574 netdev_err(priv->dev,
575 "deep sleep cancellation failed: %d\n", ret);
591 return ret; 576 return ret;
592 } 577 }
593 priv->deep_sleep_required = 1; 578 priv->deep_sleep_required = 1;
@@ -620,7 +605,8 @@ int lbs_resume(struct lbs_private *priv)
620 priv->deep_sleep_required = 0; 605 priv->deep_sleep_required = 0;
621 ret = lbs_set_deep_sleep(priv, 1); 606 ret = lbs_set_deep_sleep(priv, 1);
622 if (ret) 607 if (ret)
623 lbs_pr_err("deep sleep activation failed: %d\n", ret); 608 netdev_err(priv->dev,
609 "deep sleep activation failed: %d\n", ret);
624 } 610 }
625 611
626 if (priv->setup_fw_on_resume) 612 if (priv->setup_fw_on_resume)
@@ -648,8 +634,8 @@ static void lbs_cmd_timeout_handler(unsigned long data)
648 if (!priv->cur_cmd) 634 if (!priv->cur_cmd)
649 goto out; 635 goto out;
650 636
651 lbs_pr_info("command 0x%04x timed out\n", 637 netdev_info(priv->dev, "command 0x%04x timed out\n",
652 le16_to_cpu(priv->cur_cmd->cmdbuf->command)); 638 le16_to_cpu(priv->cur_cmd->cmdbuf->command));
653 639
654 priv->cmd_timed_out = 1; 640 priv->cmd_timed_out = 1;
655 wake_up_interruptible(&priv->waitq); 641 wake_up_interruptible(&priv->waitq);
@@ -754,7 +740,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
754 740
755 /* Allocate the command buffers */ 741 /* Allocate the command buffers */
756 if (lbs_allocate_cmd_buffer(priv)) { 742 if (lbs_allocate_cmd_buffer(priv)) {
757 lbs_pr_err("Out of memory allocating command buffers\n"); 743 pr_err("Out of memory allocating command buffers\n");
758 ret = -ENOMEM; 744 ret = -ENOMEM;
759 goto out; 745 goto out;
760 } 746 }
@@ -764,7 +750,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
764 /* Create the event FIFO */ 750 /* Create the event FIFO */
765 ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL); 751 ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL);
766 if (ret) { 752 if (ret) {
767 lbs_pr_err("Out of memory allocating event FIFO buffer\n"); 753 pr_err("Out of memory allocating event FIFO buffer\n");
768 goto out; 754 goto out;
769 } 755 }
770 756
@@ -791,7 +777,6 @@ static const struct net_device_ops lbs_netdev_ops = {
791 .ndo_stop = lbs_eth_stop, 777 .ndo_stop = lbs_eth_stop,
792 .ndo_start_xmit = lbs_hard_start_xmit, 778 .ndo_start_xmit = lbs_hard_start_xmit,
793 .ndo_set_mac_address = lbs_set_mac_address, 779 .ndo_set_mac_address = lbs_set_mac_address,
794 .ndo_tx_timeout = lbs_tx_timeout,
795 .ndo_set_multicast_list = lbs_set_multicast_list, 780 .ndo_set_multicast_list = lbs_set_multicast_list,
796 .ndo_change_mtu = eth_change_mtu, 781 .ndo_change_mtu = eth_change_mtu,
797 .ndo_validate_addr = eth_validate_addr, 782 .ndo_validate_addr = eth_validate_addr,
@@ -816,7 +801,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
816 /* Allocate an Ethernet device and register it */ 801 /* Allocate an Ethernet device and register it */
817 wdev = lbs_cfg_alloc(dmdev); 802 wdev = lbs_cfg_alloc(dmdev);
818 if (IS_ERR(wdev)) { 803 if (IS_ERR(wdev)) {
819 lbs_pr_err("cfg80211 init failed\n"); 804 pr_err("cfg80211 init failed\n");
820 goto done; 805 goto done;
821 } 806 }
822 807
@@ -825,7 +810,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
825 priv->wdev = wdev; 810 priv->wdev = wdev;
826 811
827 if (lbs_init_adapter(priv)) { 812 if (lbs_init_adapter(priv)) {
828 lbs_pr_err("failed to initialize adapter structure.\n"); 813 pr_err("failed to initialize adapter structure\n");
829 goto err_wdev; 814 goto err_wdev;
830 } 815 }
831 816
@@ -957,17 +942,20 @@ int lbs_start_card(struct lbs_private *priv)
957 goto done; 942 goto done;
958 943
959 if (lbs_cfg_register(priv)) { 944 if (lbs_cfg_register(priv)) {
960 lbs_pr_err("cannot register device\n"); 945 pr_err("cannot register device\n");
961 goto done; 946 goto done;
962 } 947 }
963 948
964 lbs_update_channel(priv); 949 lbs_update_channel(priv);
965 950
966 lbs_init_mesh(priv); 951 if (!lbs_disablemesh)
952 lbs_init_mesh(priv);
953 else
954 pr_info("%s: mesh disabled\n", dev->name);
967 955
968 lbs_debugfs_init_one(priv, dev); 956 lbs_debugfs_init_one(priv, dev);
969 957
970 lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name); 958 netdev_info(dev, "Marvell WLAN 802.11 adapter\n");
971 959
972 ret = 0; 960 ret = 0;
973 961
@@ -1094,16 +1082,16 @@ int lbs_get_firmware(struct device *dev, const char *user_helper,
1094 if (user_helper) { 1082 if (user_helper) {
1095 ret = request_firmware(helper, user_helper, dev); 1083 ret = request_firmware(helper, user_helper, dev);
1096 if (ret) { 1084 if (ret) {
1097 lbs_pr_err("couldn't find helper firmware %s", 1085 dev_err(dev, "couldn't find helper firmware %s\n",
1098 user_helper); 1086 user_helper);
1099 goto fail; 1087 goto fail;
1100 } 1088 }
1101 } 1089 }
1102 if (user_mainfw) { 1090 if (user_mainfw) {
1103 ret = request_firmware(mainfw, user_mainfw, dev); 1091 ret = request_firmware(mainfw, user_mainfw, dev);
1104 if (ret) { 1092 if (ret) {
1105 lbs_pr_err("couldn't find main firmware %s", 1093 dev_err(dev, "couldn't find main firmware %s\n",
1106 user_mainfw); 1094 user_mainfw);
1107 goto fail; 1095 goto fail;
1108 } 1096 }
1109 } 1097 }
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c
index a0804d12bf20..24cf06680c6b 100644
--- a/drivers/net/wireless/libertas/mesh.c
+++ b/drivers/net/wireless/libertas/mesh.c
@@ -1,3 +1,5 @@
1#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2
1#include <linux/delay.h> 3#include <linux/delay.h>
2#include <linux/etherdevice.h> 4#include <linux/etherdevice.h>
3#include <linux/netdevice.h> 5#include <linux/netdevice.h>
@@ -267,7 +269,7 @@ int lbs_init_mesh(struct lbs_private *priv)
267 lbs_add_mesh(priv); 269 lbs_add_mesh(priv);
268 270
269 if (device_create_file(&dev->dev, &dev_attr_lbs_mesh)) 271 if (device_create_file(&dev->dev, &dev_attr_lbs_mesh))
270 lbs_pr_err("cannot register lbs_mesh attribute\n"); 272 netdev_err(dev, "cannot register lbs_mesh attribute\n");
271 273
272 ret = 1; 274 ret = 1;
273 } 275 }
@@ -395,7 +397,7 @@ int lbs_add_mesh(struct lbs_private *priv)
395 /* Register virtual mesh interface */ 397 /* Register virtual mesh interface */
396 ret = register_netdev(mesh_dev); 398 ret = register_netdev(mesh_dev);
397 if (ret) { 399 if (ret) {
398 lbs_pr_err("cannot register mshX virtual interface\n"); 400 pr_err("cannot register mshX virtual interface\n");
399 goto err_free; 401 goto err_free;
400 } 402 }
401 403
@@ -973,7 +975,7 @@ static ssize_t mesh_id_get(struct device *dev, struct device_attribute *attr,
973 return ret; 975 return ret;
974 976
975 if (defs.meshie.val.mesh_id_len > IEEE80211_MAX_SSID_LEN) { 977 if (defs.meshie.val.mesh_id_len > IEEE80211_MAX_SSID_LEN) {
976 lbs_pr_err("inconsistent mesh ID length"); 978 dev_err(dev, "inconsistent mesh ID length\n");
977 defs.meshie.val.mesh_id_len = IEEE80211_MAX_SSID_LEN; 979 defs.meshie.val.mesh_id_len = IEEE80211_MAX_SSID_LEN;
978 } 980 }
979 981
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index a3f4b55aa41f..fdb0448301a0 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -1,6 +1,9 @@
1/* 1/*
2 * This file contains the handling of RX in wlan driver. 2 * This file contains the handling of RX in wlan driver.
3 */ 3 */
4
5#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6
4#include <linux/etherdevice.h> 7#include <linux/etherdevice.h>
5#include <linux/slab.h> 8#include <linux/slab.h>
6#include <linux/types.h> 9#include <linux/types.h>
@@ -191,7 +194,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
191 case 12: /* 54 Mbps */ 194 case 12: /* 54 Mbps */
192 return 108; 195 return 108;
193 } 196 }
194 lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate); 197 pr_alert("Invalid Marvell WLAN rate %i\n", rate);
195 return 0; 198 return 0;
196} 199}
197 200
@@ -248,7 +251,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
248 /* add space for the new radio header */ 251 /* add space for the new radio header */
249 if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && 252 if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) &&
250 pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, GFP_ATOMIC)) { 253 pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, GFP_ATOMIC)) {
251 lbs_pr_alert("%s: couldn't pskb_expand_head\n", __func__); 254 netdev_alert(dev, "%s: couldn't pskb_expand_head\n", __func__);
252 ret = -ENOMEM; 255 ret = -ENOMEM;
253 kfree_skb(skb); 256 kfree_skb(skb);
254 goto done; 257 goto done;