Skip to content

Commit

Permalink
libertas: Use netdev_<level> or dev_<level> where possible
Browse files Browse the repository at this point in the history
Using the more descriptive logging styles gives a bit
more information about the device being operated on.

Makes the object trivially smaller too.

$ size drivers/net/wireless/libertas/built-in.o.*
 187730	   2973	  38488	 229191	  37f47	drivers/net/wireless/libertas/built-in.o.new
 188195	   2973	  38488	 229656	  38118	drivers/net/wireless/libertas/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Joe Perches authored and John W. Linville committed May 11, 2011
1 parent 0e4e06a commit f3a57fd
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 93 deletions.
9 changes: 5 additions & 4 deletions drivers/net/wireless/libertas/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,8 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
sme->ssid, sme->ssid_len,
WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
if (!bss) {
pr_err("assoc: bss %pM not in scan results\n", sme->bssid);
wiphy_err(wiphy, "assoc: bss %pM not in scan results\n",
sme->bssid);
ret = -ENOENT;
goto done;
}
Expand Down Expand Up @@ -1381,8 +1382,8 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
lbs_enable_rsn(priv, sme->crypto.cipher_group != 0);
break;
default:
pr_err("unsupported cipher group 0x%x\n",
sme->crypto.cipher_group);
wiphy_err(wiphy, "unsupported cipher group 0x%x\n",
sme->crypto.cipher_group);
ret = -ENOTSUPP;
goto done;
}
Expand Down Expand Up @@ -1500,7 +1501,7 @@ static int lbs_cfg_add_key(struct wiphy *wiphy, struct net_device *netdev,
params->key, params->key_len);
break;
default:
pr_err("unhandled cipher 0x%x\n", params->cipher);
wiphy_err(wiphy, "unhandled cipher 0x%x\n", params->cipher);
ret = -ENOTSUPP;
break;
}
Expand Down
42 changes: 24 additions & 18 deletions drivers/net/wireless/libertas/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* It prepares command and sends it to firmware when it is ready.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kfifo.h>
#include <linux/sched.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -112,7 +110,7 @@ int lbs_update_hw_spec(struct lbs_private *priv)
* CF card firmware 5.0.16p0: cap 0x00000303
* USB dongle firmware 5.110.17p2: cap 0x00000303
*/
pr_info("%pM, fw %u.%u.%up%u, cap 0x%08x\n",
netdev_info(priv->dev, "%pM, fw %u.%u.%up%u, cap 0x%08x\n",
cmd.permanentaddr,
priv->fwrelease >> 24 & 0xff,
priv->fwrelease >> 16 & 0xff,
Expand Down Expand Up @@ -143,7 +141,8 @@ int lbs_update_hw_spec(struct lbs_private *priv)
/* if it's unidentified region code, use the default (USA) */
if (i >= MRVDRV_MAX_REGION_CODE) {
priv->regioncode = 0x10;
pr_info("unidentified region code; using the default (USA)\n");
netdev_info(priv->dev,
"unidentified region code; using the default (USA)\n");
}

if (priv->current_addr[0] == 0xff)
Expand Down Expand Up @@ -213,7 +212,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,
(uint8_t *)&cmd_config.wol_conf,
sizeof(struct wol_config));
} else {
pr_info("HOST_SLEEP_CFG failed %d\n", ret);
netdev_info(priv->dev, "HOST_SLEEP_CFG failed %d\n", ret);
}

return ret;
Expand Down Expand Up @@ -316,7 +315,7 @@ static int lbs_wait_for_ds_awake(struct lbs_private *priv)
if (priv->is_deep_sleep) {
if (!wait_event_interruptible_timeout(priv->ds_awake_q,
!priv->is_deep_sleep, (10 * HZ))) {
pr_err("ds_awake_q: timer expired\n");
netdev_err(priv->dev, "ds_awake_q: timer expired\n");
ret = -1;
}
}
Expand All @@ -341,7 +340,7 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep)
netif_carrier_off(priv->dev);
}
} else {
pr_err("deep sleep: already enabled\n");
netdev_err(priv->dev, "deep sleep: already enabled\n");
}
} else {
if (priv->is_deep_sleep) {
Expand All @@ -351,7 +350,8 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep)
if (!ret) {
ret = lbs_wait_for_ds_awake(priv);
if (ret)
pr_err("deep sleep: wakeup failed\n");
netdev_err(priv->dev,
"deep sleep: wakeup failed\n");
}
}
}
Expand Down Expand Up @@ -385,8 +385,9 @@ int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep)
ret = lbs_host_sleep_cfg(priv, priv->wol_criteria,
(struct wol_config *)NULL);
if (ret) {
pr_info("Host sleep configuration failed: %d\n",
ret);
netdev_info(priv->dev,
"Host sleep configuration failed: %d\n",
ret);
return ret;
}
if (priv->psstate == PS_STATE_FULL_POWER) {
Expand All @@ -396,19 +397,21 @@ int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep)
sizeof(cmd),
lbs_ret_host_sleep_activate, 0);
if (ret)
pr_info("HOST_SLEEP_ACTIVATE failed: %d\n",
ret);
netdev_info(priv->dev,
"HOST_SLEEP_ACTIVATE failed: %d\n",
ret);
}

if (!wait_event_interruptible_timeout(
priv->host_sleep_q,
priv->is_host_sleep_activated,
(10 * HZ))) {
pr_err("host_sleep_q: timer expired\n");
netdev_err(priv->dev,
"host_sleep_q: timer expired\n");
ret = -1;
}
} else {
pr_err("host sleep: already enabled\n");
netdev_err(priv->dev, "host sleep: already enabled\n");
}
} else {
if (priv->is_host_sleep_activated)
Expand Down Expand Up @@ -1008,7 +1011,8 @@ static void lbs_submit_command(struct lbs_private *priv,
ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize);

if (ret) {
pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret);
netdev_info(priv->dev, "DNLD_CMD: hw_host_to_card failed: %d\n",
ret);
/* Let the timer kick in and retry, and potentially reset
the whole thing if the condition persists */
timeo = HZ/4;
Expand Down Expand Up @@ -1277,7 +1281,8 @@ int lbs_execute_next_command(struct lbs_private *priv)
spin_lock_irqsave(&priv->driver_lock, flags);

if (priv->cur_cmd) {
pr_alert( "EXEC_NEXT_CMD: already processing command!\n");
netdev_alert(priv->dev,
"EXEC_NEXT_CMD: already processing command!\n");
spin_unlock_irqrestore(&priv->driver_lock, flags);
ret = -1;
goto done;
Expand Down Expand Up @@ -1439,7 +1444,7 @@ static void lbs_send_confirmsleep(struct lbs_private *priv)
ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &confirm_sleep,
sizeof(confirm_sleep));
if (ret) {
pr_alert("confirm_sleep failed\n");
netdev_alert(priv->dev, "confirm_sleep failed\n");
goto out;
}

Expand Down Expand Up @@ -1665,7 +1670,8 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
spin_lock_irqsave(&priv->driver_lock, flags);
ret = cmdnode->result;
if (ret)
pr_info("PREP_CMD: command 0x%04x failed: %d\n", command, ret);
netdev_info(priv->dev, "PREP_CMD: command 0x%04x failed: %d\n",
command, ret);

__lbs_cleanup_and_insert_cmd(priv, cmdnode);
spin_unlock_irqrestore(&priv->driver_lock, flags);
Expand Down
32 changes: 16 additions & 16 deletions drivers/net/wireless/libertas/cmdresp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* responses as well as events generated by firmware.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/sched.h>
Expand Down Expand Up @@ -88,17 +86,18 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len);

if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) {
pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n",
le16_to_cpu(resp->seqnum),
le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
netdev_info(priv->dev,
"Received CMD_RESP with invalid sequence %d (expected %d)\n",
le16_to_cpu(resp->seqnum),
le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
spin_unlock_irqrestore(&priv->driver_lock, flags);
ret = -1;
goto done;
}
if (respcmd != CMD_RET(curcmd) &&
respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) {
pr_info("Invalid CMD_RESP %x to command %x!\n",
respcmd, curcmd);
netdev_info(priv->dev, "Invalid CMD_RESP %x to command %x!\n",
respcmd, curcmd);
spin_unlock_irqrestore(&priv->driver_lock, flags);
ret = -1;
goto done;
Expand All @@ -107,8 +106,9 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
if (resp->result == cpu_to_le16(0x0004)) {
/* 0x0004 means -EAGAIN. Drop the response, let it time out
and be resubmitted */
pr_info("Firmware returns DEFER to command %x. Will let it time out...\n",
le16_to_cpu(resp->command));
netdev_info(priv->dev,
"Firmware returns DEFER to command %x. Will let it time out...\n",
le16_to_cpu(resp->command));
spin_unlock_irqrestore(&priv->driver_lock, flags);
ret = -1;
goto done;
Expand Down Expand Up @@ -319,28 +319,28 @@ int lbs_process_event(struct lbs_private *priv, u32 event)
lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
break;
case MACREG_INT_CODE_RSSI_LOW:
pr_alert("EVENT: rssi low\n");
netdev_alert(priv->dev, "EVENT: rssi low\n");
break;
case MACREG_INT_CODE_SNR_LOW:
pr_alert("EVENT: snr low\n");
netdev_alert(priv->dev, "EVENT: snr low\n");
break;
case MACREG_INT_CODE_MAX_FAIL:
pr_alert("EVENT: max fail\n");
netdev_alert(priv->dev, "EVENT: max fail\n");
break;
case MACREG_INT_CODE_RSSI_HIGH:
pr_alert("EVENT: rssi high\n");
netdev_alert(priv->dev, "EVENT: rssi high\n");
break;
case MACREG_INT_CODE_SNR_HIGH:
pr_alert("EVENT: snr high\n");
netdev_alert(priv->dev, "EVENT: snr high\n");
break;

case MACREG_INT_CODE_MESH_AUTO_STARTED:
/* Ignore spurious autostart events */
pr_info("EVENT: MESH_AUTO_STARTED (ignoring)\n");
netdev_info(priv->dev, "EVENT: MESH_AUTO_STARTED (ignoring)\n");
break;

default:
pr_alert("EVENT: unknown event id %d\n", event);
netdev_alert(priv->dev, "EVENT: unknown event id %d\n", event);
break;
}

Expand Down
7 changes: 3 additions & 4 deletions drivers/net/wireless/libertas/debugfs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/dcache.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
Expand Down Expand Up @@ -153,13 +151,14 @@ static ssize_t lbs_host_sleep_write(struct file *file,
ret = lbs_set_host_sleep(priv, 0);
else if (host_sleep == 1) {
if (priv->wol_criteria == EHS_REMOVE_WAKEUP) {
pr_info("wake parameters not configured\n");
netdev_info(priv->dev,
"wake parameters not configured\n");
ret = -EINVAL;
goto out_unlock;
}
ret = lbs_set_host_sleep(priv, 1);
} else {
pr_err("invalid option\n");
netdev_err(priv->dev, "invalid option\n");
ret = -EINVAL;
}

Expand Down
15 changes: 10 additions & 5 deletions drivers/net/wireless/libertas/if_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ static int if_cs_send_cmd(struct lbs_private *priv, u8 *buf, u16 nb)
if (status & IF_CS_BIT_COMMAND)
break;
if (++loops > 100) {
pr_err("card not ready for commands\n");
netdev_err(priv->dev, "card not ready for commands\n");
goto done;
}
mdelay(1);
Expand Down Expand Up @@ -434,14 +434,16 @@ static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len)
/* is hardware ready? */
status = if_cs_read16(priv->card, IF_CS_CARD_STATUS);
if ((status & IF_CS_BIT_RESP) == 0) {
pr_err("no cmd response in card\n");
netdev_err(priv->dev, "no cmd response in card\n");
*len = 0;
goto out;
}

*len = if_cs_read16(priv->card, IF_CS_RESP_LEN);
if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) {
pr_err("card cmd buffer has invalid # of bytes (%d)\n", *len);
netdev_err(priv->dev,
"card cmd buffer has invalid # of bytes (%d)\n",
*len);
goto out;
}

Expand Down Expand Up @@ -475,7 +477,9 @@ static struct sk_buff *if_cs_receive_data(struct lbs_private *priv)

len = if_cs_read16(priv->card, IF_CS_READ_LEN);
if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
pr_err("card data buffer has invalid # of bytes (%d)\n", len);
netdev_err(priv->dev,
"card data buffer has invalid # of bytes (%d)\n",
len);
priv->dev->stats.rx_dropped++;
goto dat_err;
}
Expand Down Expand Up @@ -761,7 +765,8 @@ static int if_cs_host_to_card(struct lbs_private *priv,
ret = if_cs_send_cmd(priv, buf, nb);
break;
default:
pr_err("%s: unsupported type %d\n", __func__, type);
netdev_err(priv->dev, "%s: unsupported type %d\n",
__func__, type);
}

lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
Expand Down
19 changes: 10 additions & 9 deletions drivers/net/wireless/libertas/if_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ static int if_sdio_enter_deep_sleep(struct lbs_private *priv)
ret = __lbs_cmd(priv, CMD_802_11_DEEP_SLEEP, &cmd, sizeof(cmd),
lbs_cmd_copyback, (unsigned long) &cmd);
if (ret)
pr_err("DEEP_SLEEP cmd failed\n");
netdev_err(priv->dev, "DEEP_SLEEP cmd failed\n");

mdelay(200);
return ret;
Expand All @@ -867,7 +867,7 @@ static int if_sdio_exit_deep_sleep(struct lbs_private *priv)

sdio_writeb(card->func, HOST_POWER_UP, CONFIGURATION_REG, &ret);
if (ret)
pr_err("sdio_writeb failed!\n");
netdev_err(priv->dev, "sdio_writeb failed!\n");

sdio_release_host(card->func);
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
Expand All @@ -884,7 +884,7 @@ static int if_sdio_reset_deep_sleep_wakeup(struct lbs_private *priv)

sdio_writeb(card->func, 0, CONFIGURATION_REG, &ret);
if (ret)
pr_err("sdio_writeb failed!\n");
netdev_err(priv->dev, "sdio_writeb failed!\n");

sdio_release_host(card->func);
lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
Expand Down Expand Up @@ -1103,7 +1103,7 @@ static int if_sdio_probe(struct sdio_func *func,
lbs_deb_sdio("send function INIT command\n");
if (__lbs_cmd(priv, CMD_FUNC_INIT, &cmd, sizeof(cmd),
lbs_cmd_copyback, (unsigned long) &cmd))
pr_alert("CMD_FUNC_INIT cmd failed\n");
netdev_alert(priv->dev, "CMD_FUNC_INIT cmd failed\n");
}

ret = lbs_start_card(priv);
Expand Down Expand Up @@ -1204,19 +1204,20 @@ static int if_sdio_suspend(struct device *dev)

mmc_pm_flag_t flags = sdio_get_host_pm_caps(func);

pr_info("%s: suspend: PM flags = 0x%x\n", sdio_func_id(func), flags);
dev_info(dev, "%s: suspend: PM flags = 0x%x\n",
sdio_func_id(func), flags);

/* If we aren't being asked to wake on anything, we should bail out
* and let the SD stack power down the card.
*/
if (card->priv->wol_criteria == EHS_REMOVE_WAKEUP) {
pr_info("Suspend without wake params -- powering down card\n");
dev_info(dev, "Suspend without wake params -- powering down card\n");
return -ENOSYS;
}

if (!(flags & MMC_PM_KEEP_POWER)) {
pr_err("%s: cannot remain alive while host is suspended\n",
sdio_func_id(func));
dev_err(dev, "%s: cannot remain alive while host is suspended\n",
sdio_func_id(func));
return -ENOSYS;
}

Expand All @@ -1237,7 +1238,7 @@ static int if_sdio_resume(struct device *dev)
struct if_sdio_card *card = sdio_get_drvdata(func);
int ret;

pr_info("%s: resume: we're back\n", sdio_func_id(func));
dev_info(dev, "%s: resume: we're back\n", sdio_func_id(func));

ret = lbs_resume(card->priv);

Expand Down
Loading

0 comments on commit f3a57fd

Please sign in to comment.