aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2007-06-13 21:11:42 -0400
committerGuido Guenther <agx@sigxcpu.org>2007-06-14 10:11:09 +0200
commitba70c3d8851f5af2110b1a8b5228c400014f5693 (patch)
tree00af551684b384515f45b33a6c63b1c667cfcb1f
parent4378f631f40b2f9186f2169119f052eae88ad565 (diff)
[PATCH] Improve info messages, avoid printing full path
Never use __FILE__, as it prints full path to the driver, which is rarely needed. Use DRIVER_NAME instead. Replace all occurrences of info() with printk() calls. Ensure that the messages are properly formatted and use the netdevice name if possible. Print MAC address, firmware version and regulatory domain after the device is registered, so we can provide the device name. Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r--at76_usb.c97
-rw-r--r--at76_usb.h2
2 files changed, 53 insertions, 46 deletions
diff --git a/at76_usb.c b/at76_usb.c
index c763457..d363ff9 100644
--- a/at76_usb.c
+++ b/at76_usb.c
@@ -871,8 +871,9 @@ static int at76_set_mib(struct at76_priv *priv, struct set_mib_buffer *buf)
if (ret >= 0) {
ret = at76_wait_completion(priv, CMD_SET_MIB);
if (ret != CMD_STATUS_COMPLETE) {
- info("%s: set_mib: at76_wait_completion failed "
- "with %d", priv->netdev->name, ret);
+ printk(KERN_INFO
+ "%s: set_mib: at76_wait_completion failed "
+ "with %d\n", priv->netdev->name, ret);
ret = -EIO;
}
}
@@ -1400,7 +1401,8 @@ static int at76_get_current_bssid(struct at76_priv *priv)
goto err;
}
memcpy(priv->bssid, mac_mgmt->current_bssid, ETH_ALEN);
- info("using BSSID %s", mac2str(priv->bssid));
+ printk(KERN_INFO "%s: using BSSID %s\n", priv->netdev->name,
+ mac2str(priv->bssid));
err:
kfree(mac_mgmt);
exit:
@@ -2451,9 +2453,10 @@ static int at76_iw_handler_set_freq(struct net_device *netdev,
ret = -EINVAL;
} else if (!priv->international_roaming) {
if (!(priv->domain->channel_map & (1 << (chan - 1)))) {
- info("%s: channel %d not allowed for domain %s "
- "(and international_roaming is OFF)",
- priv->netdev->name, chan, priv->domain->name);
+ printk(KERN_INFO
+ "%s: channel %d not allowed for domain %s "
+ "(and international_roaming is OFF)\n",
+ priv->netdev->name, chan, priv->domain->name);
ret = -EINVAL;
}
}
@@ -3999,10 +4002,6 @@ static int at76_init_new_device(struct at76_priv *priv,
else
priv->rx_data_fcs_len = 4;
- info("firmware version %d.%d.%d #%d (fcs_len %d)",
- req_fw_version.major, req_fw_version.minor,
- req_fw_version.patch, req_fw_version.build, priv->rx_data_fcs_len);
-
/* MAC address */
ret = at76_get_hw_config(priv);
if (ret < 0) {
@@ -4013,9 +4012,6 @@ static int at76_init_new_device(struct at76_priv *priv,
priv->domain = at76_get_reg_domain(priv->regulatory_domain);
/* init. netdev->dev_addr */
memcpy(netdev->dev_addr, priv->mac_addr, ETH_ALEN);
- info("device's MAC %s, regulatory domain %s (id %d)",
- mac2str(priv->mac_addr), priv->domain->name,
- priv->regulatory_domain);
/* initializing */
priv->international_roaming = IR_OFF;
@@ -4057,9 +4053,17 @@ static int at76_init_new_device(struct at76_priv *priv,
priv->netdev->name, ret);
goto error;
}
- info("registered %s", priv->netdev->name);
priv->netdev_registered = 1;
+ printk(KERN_INFO "%s: MAC address %s\n", netdev->name,
+ mac2str(priv->mac_addr));
+ printk(KERN_INFO "%s: firmware version %d.%d.%d #%d (fcs_len %d)\n",
+ netdev->name, req_fw_version.major, req_fw_version.minor,
+ req_fw_version.patch, req_fw_version.build,
+ priv->rx_data_fcs_len);
+ printk(KERN_INFO "%s: regulatory domain %s (id %d)\n", netdev->name,
+ priv->domain->name, priv->regulatory_domain);
+
/* we let this timer run the whole time this driver instance lives */
mod_timer(&priv->bss_list_timer, jiffies + BSS_LIST_TIMEOUT);
@@ -4091,7 +4095,7 @@ static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
}
if (fwe->board_type == BOARDTYPE_505A_RFMD_2958) {
- info("200 ms delay for board type 7");
+ at76_dbg(DBG_DEVSTART, "200 ms delay for board type 7");
schedule_timeout_interruptible(HZ / 5 + 1);
}
return 0;
@@ -4290,9 +4294,10 @@ static void at76_work_join(struct work_struct *work)
err("%s join_bss completed with %d",
priv->netdev->name, ret);
else
- info("%s join_bss ssid %s timed out",
- priv->netdev->name,
- mac2str(priv->curr_bss->bssid));
+ printk(KERN_INFO
+ "%s: join_bss ssid %s timed out\n",
+ priv->netdev->name,
+ mac2str(priv->curr_bss->bssid));
/* retry next BSS immediately */
schedule_work(&priv->work_join);
@@ -4365,8 +4370,8 @@ static void at76_work_mgmt_timeout(struct work_struct *work)
case CONNECTED: /* we haven't received the beacon of this BSS for
BEACON_TIMEOUT seconds */
- info("%s: lost beacon bssid %s",
- priv->netdev->name, mac2str(priv->curr_bss->bssid));
+ printk(KERN_INFO "%s: lost beacon bssid %s\n",
+ priv->netdev->name, mac2str(priv->curr_bss->bssid));
/* jal: starting mgmt_timer in ad-hoc mode is questionable,
but I'll leave it here to track down another lockup problem */
if (priv->iw_mode != IW_MODE_ADHOC) {
@@ -4730,8 +4735,8 @@ static void at76_rx_mgmt_assoc(struct at76_priv *priv,
}
del_timer_sync(&priv->mgmt_timer);
} else {
- info("%s: AssocResp in state %d ignored",
- priv->netdev->name, priv->istate);
+ printk(KERN_INFO "%s: AssocResp in state %d ignored\n",
+ priv->netdev->name, priv->istate);
}
}
@@ -4782,8 +4787,8 @@ static void at76_rx_mgmt_reassoc(struct at76_priv *priv,
schedule_work(&priv->work_join);
}
} else {
- info("%s: ReAssocResp in state %d ignored",
- priv->netdev->name, priv->istate);
+ printk(KERN_INFO "%s: ReAssocResp in state %d ignored\n",
+ priv->netdev->name, priv->istate);
}
}
@@ -4830,8 +4835,8 @@ static void at76_rx_mgmt_disassoc(struct at76_priv *priv,
schedule_work(&priv->work_join);
} else {
/* ignore DisAssoc in states AUTH, ASSOC */
- info("%s: DisAssoc in state %d ignored",
- priv->netdev->name, priv->istate);
+ printk(KERN_INFO "%s: DisAssoc in state %d ignored\n",
+ priv->netdev->name, priv->istate);
}
}
/* ignore DisAssoc to other STA or from other BSSID */
@@ -4856,13 +4861,13 @@ static void at76_rx_mgmt_auth(struct at76_priv *priv,
priv->netdev->name, hex2str(resp->info_element, 18));
}
if (priv->istate != AUTHENTICATING) {
- info("%s: ignored AuthFrame in state %d",
- priv->netdev->name, priv->istate);
+ printk(KERN_INFO "%s: ignored AuthFrame in state %d\n",
+ priv->netdev->name, priv->istate);
return;
}
if (priv->auth_mode != alg) {
- info("%s: ignored AuthFrame for alg %d",
- priv->netdev->name, alg);
+ printk(KERN_INFO "%s: ignored AuthFrame for alg %d\n",
+ priv->netdev->name, alg);
return;
}
@@ -4937,8 +4942,8 @@ static void at76_rx_mgmt_deauth(struct at76_priv *priv,
/* ignore DeAuth to other STA or from other BSSID */
} else {
/* ignore DeAuth in states SCANNING */
- info("%s: DeAuth in state %d ignored",
- priv->netdev->name, priv->istate);
+ printk(KERN_INFO "%s: DeAuth in state %d ignored\n",
+ priv->netdev->name, priv->istate);
}
}
@@ -5239,8 +5244,8 @@ static void at76_rx_mgmt(struct at76_priv *priv, struct at76_rx_buffer *buf)
break;
default:
- info("%s: mgmt, but not beacon, subtype = %x",
- priv->netdev->name, subtype);
+ printk(KERN_INFO "%s: mgmt, but not beacon, subtype = %x\n",
+ priv->netdev->name, subtype);
}
return;
@@ -5257,7 +5262,7 @@ static void at76_dbg_dumpbuf(const char *tag, const u8 *buf, int size)
if ((i % 8) == 0) {
if (i)
pr_debug("\n");
- pr_debug(__FILE__ ": %s: ", tag);
+ pr_debug(DRIVER_NAME ": %s: ", tag);
}
pr_debug("%02x ", buf[i]);
}
@@ -5397,7 +5402,8 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
if (data_len < 0) {
/* make sure data starts in the buffer */
- info("%s: data frame too short", priv->netdev->name);
+ printk(KERN_INFO "%s: data frame too short\n",
+ priv->netdev->name);
return NULL;
}
@@ -5479,9 +5485,10 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
/* for test only ??? */
left = skb_tailroom(bptr->skb);
if (left < data_len) {
- info("%s: only %d byte free (need %d)",
- priv->netdev->name, left,
- data_len);
+ printk(KERN_INFO
+ "%s: only %d byte free (need %d)\n",
+ priv->netdev->name, left,
+ data_len);
} else
memcpy(skb_put(bptr->skb, data_len),
data, data_len);
@@ -5789,8 +5796,8 @@ static void at76_rx_tasklet(unsigned long param)
break;
default:
- info("%s: it's a frame from mars: %2x", priv->netdev->name,
- frame_ctl);
+ printk(KERN_INFO "%s: it's a frame from mars: %2x\n",
+ priv->netdev->name, frame_ctl);
}
finish:
at76_submit_rx_urb(priv);
@@ -6037,9 +6044,9 @@ static void at76_disconnect(struct usb_interface *interface)
if (!priv)
return;
- info("%s disconnecting", priv->netdev->name);
+ printk(KERN_INFO "%s: disconnecting\n", priv->netdev->name);
at76_delete_device(priv);
- info(DRIVER_NAME " disconnected");
+ printk(KERN_INFO DRIVER_NAME ": disconnected\n");
}
/* structure for registering this driver with the USB subsystem */
@@ -6054,7 +6061,7 @@ static int __init at76_mod_init(void)
{
int result;
- info(DRIVER_DESC " " DRIVER_VERSION " loading");
+ printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION " loading\n");
/* register this driver with the USB subsystem */
result = usb_register(&at76_driver);
@@ -6070,7 +6077,7 @@ static void __exit at76_mod_exit(void)
{
int i;
- info(DRIVER_DESC " " DRIVER_VERSION " unloading");
+ printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION " unloading\n");
usb_deregister(&at76_driver);
for (i = 0; i < ARRAY_SIZE(firmwares); i++) {
if (firmwares[i].fw)
diff --git a/at76_usb.h b/at76_usb.h
index aeabc4a..9a8c327 100644
--- a/at76_usb.h
+++ b/at76_usb.h
@@ -682,7 +682,7 @@ struct at76_rx_radiotap {
#define at76_dbg(bits, format, arg...) \
do { \
if (at76_debug & (bits)) \
- printk(KERN_DEBUG __FILE__ ": " format "\n" , ## arg);\
+ printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg);\
} while (0)
#define at76_assert(x) \