From: Pavel Roskin <proski@gnu.org>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 32/35] Massive cleanup of dump functions
Date: Sat, 01 Sep 2007 00:37:17 -0400 [thread overview]
Message-ID: <20070901043717.2498.87983.stgit@dv.roinet.com> (raw)
In-Reply-To: <20070901043233.2498.95850.stgit@dv.roinet.com>
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
drivers/net/wireless/at76_usb.c | 195 ++++++++++++++++-----------------------
1 files changed, 79 insertions(+), 116 deletions(-)
diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 89eca8d..dc56bf4 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -1029,24 +1029,22 @@ static int at76_set_group_address(struct at76_priv *priv, u8 *addr, int n)
}
#endif
-static int at76_dump_mib_mac_addr(struct at76_priv *priv)
+static void at76_dump_mib_mac_addr(struct at76_priv *priv)
{
int i;
- int ret = 0;
- struct mib_mac_addr *m =
- kmalloc(sizeof(struct mib_mac_addr), GFP_KERNEL);
+ int ret;
+ struct mib_mac_addr *m = kmalloc(sizeof(struct mib_mac_addr),
+ GFP_KERNEL);
- if (!m) {
- ret = -ENOMEM;
- goto exit;
- }
+ if (!m)
+ return;
- ret = at76_get_mib(priv->udev, MIB_MAC_ADDR,
- m, sizeof(struct mib_mac_addr));
+ ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m,
+ sizeof(struct mib_mac_addr));
if (ret < 0) {
err("%s: at76_get_mib (MAC_ADDR) failed: %d",
priv->netdev->name, ret);
- goto error;
+ goto exit;
}
at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x",
@@ -1056,71 +1054,64 @@ static int at76_dump_mib_mac_addr(struct at76_priv *priv)
at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: group addr %d: %s, "
"status %d", priv->netdev->name, i,
mac2str(m->group_addr[i]), m->group_addr_status[i]);
-
-error:
- kfree(m);
exit:
- return ret;
+ kfree(m);
}
-static int at76_dump_mib_mac_wep(struct at76_priv *priv)
+static void at76_dump_mib_mac_wep(struct at76_priv *priv)
{
- int ret = 0;
- char *defkey;
+ int i;
+ int ret;
+ int key_len;
struct mib_mac_wep *m = kmalloc(sizeof(struct mib_mac_wep), GFP_KERNEL);
- if (!m) {
- ret = -ENOMEM;
- goto exit;
- }
- ret =
- at76_get_mib(priv->udev, MIB_MAC_WEP, m,
- sizeof(struct mib_mac_wep));
+ if (!m)
+ return;
+
+ ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m,
+ sizeof(struct mib_mac_wep));
if (ret < 0) {
err("%s: at76_get_mib (MAC_WEP) failed: %d", priv->netdev->name,
ret);
- goto error;
+ goto exit;
}
- if (m->wep_default_key_id < 4)
- defkey =
- hex2str(m->
- wep_default_keyvalue[m->wep_default_key_id],
- m->encryption_level == 2 ? 13 : 5);
- else
- defkey = "<invalid key id>";
-
at76_dbg(DBG_MIB, "%s: MIB MAC_WEP: priv_invoked %u def_key_id %u "
"key_len %u excl_unencr %u wep_icv_err %u wep_excluded %u "
- "encr_level %u key %d: %s", priv->netdev->name,
+ "encr_level %u key %d", priv->netdev->name,
m->privacy_invoked, m->wep_default_key_id,
m->wep_key_mapping_len, m->exclude_unencrypted,
le32_to_cpu(m->wep_icv_error_count),
le32_to_cpu(m->wep_excluded_count), m->encryption_level,
- m->wep_default_key_id, defkey);
+ m->wep_default_key_id);
-error:
- kfree(m);
+ key_len = (m->encryption_level == 1) ?
+ WEP_SMALL_KEY_LEN : WEP_LARGE_KEY_LEN;
+
+ for (i = 0; i < WEP_KEYS; i++)
+ at76_dbg(DBG_MIB, "%s: MIB MAC_WEP: key %d: %s",
+ priv->netdev->name, i,
+ hex2str(m->wep_default_keyvalue[i], key_len));
exit:
- return ret;
+ kfree(m);
}
-static int at76_dump_mib_mac_mgmt(struct at76_priv *priv)
+static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
{
- int ret = 0;
- struct mib_mac_mgmt *m =
- kmalloc(sizeof(struct mib_mac_mgmt), GFP_KERNEL);
+ int ret;
+ struct mib_mac_mgmt *m = kmalloc(sizeof(struct mib_mac_mgmt),
+ GFP_KERNEL);
char country_string[4];
- if (!m) {
- ret = -ENOMEM;
- goto exit;
- }
+ if (!m)
+ return;
+
ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m,
sizeof(struct mib_mac_mgmt));
if (ret < 0) {
- err("%s: at76_get_mib failed: %d", priv->netdev->name, ret);
- goto error;
+ err("%s: at76_get_mib (MAC_MGMT) failed: %d",
+ priv->netdev->name, ret);
+ goto exit;
}
memcpy(&country_string, m->country_string, 3);
@@ -1143,26 +1134,23 @@ static int at76_dump_mib_mac_mgmt(struct at76_priv *priv)
m->current_bss_type, m->power_mgmt_mode, m->ibss_change,
m->res, m->multi_domain_capability_implemented,
m->multi_domain_capability_enabled, country_string);
-error:
- kfree(m);
exit:
- return ret;
+ kfree(m);
}
-static int at76_dump_mib_mac(struct at76_priv *priv)
+static void at76_dump_mib_mac(struct at76_priv *priv)
{
- int ret = 0;
+ int ret;
struct mib_mac *m = kmalloc(sizeof(struct mib_mac), GFP_KERNEL);
- if (!m) {
- ret = -ENOMEM;
- goto exit;
- }
+ if (!m)
+ return;
ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac));
if (ret < 0) {
- err("%s: at76_get_mib failed: %d", priv->netdev->name, ret);
- goto error;
+ err("%s: at76_get_mib (MAC) failed: %d", priv->netdev->name,
+ ret);
+ goto exit;
}
at76_dbg(DBG_MIB, "%s: MIB MAC: max_tx_msdu_lifetime %d "
@@ -1182,26 +1170,23 @@ static int at76_dump_mib_mac(struct at76_priv *priv)
le16_to_cpu(m->listen_interval),
hex2str(m->desired_ssid, IW_ESSID_MAX_SIZE),
mac2str(m->desired_bssid), m->desired_bsstype);
-error:
- kfree(m);
exit:
- return ret;
+ kfree(m);
}
-static int at76_dump_mib_phy(struct at76_priv *priv)
+static void at76_dump_mib_phy(struct at76_priv *priv)
{
- int ret = 0;
+ int ret;
struct mib_phy *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
- if (!m) {
- ret = -ENOMEM;
- goto exit;
- }
+ if (!m)
+ return;
ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy));
if (ret < 0) {
- err("%s: at76_get_mib failed: %d", priv->netdev->name, ret);
- goto error;
+ err("%s: at76_get_mib (PHY) failed: %d", priv->netdev->name,
+ ret);
+ goto exit;
}
at76_dbg(DBG_MIB, "%s: MIB PHY: ed_threshold %d slot_time %d "
@@ -1218,81 +1203,59 @@ static int at76_dump_mib_phy(struct at76_priv *priv)
m->operation_rate_set[1], m->operation_rate_set[2],
m->operation_rate_set[3], m->channel_id, m->current_cca_mode,
m->phy_type, m->current_reg_domain);
-error:
- kfree(m);
exit:
- return ret;
+ kfree(m);
}
-static int at76_dump_mib_local(struct at76_priv *priv)
+static void at76_dump_mib_local(struct at76_priv *priv)
{
- int ret = 0;
+ int ret;
struct mib_local *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
- if (!m) {
- ret = -ENOMEM;
- goto exit;
- }
+ if (!m)
+ return;
ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local));
if (ret < 0) {
- err("%s: at76_get_mib failed: %d", priv->netdev->name, ret);
- goto error;
+ err("%s: at76_get_mib (LOCAL) failed: %d", priv->netdev->name,
+ ret);
+ goto exit;
}
- at76_dbg(DBG_MIB, "%s: MIB PHY: beacon_enable %d "
+ at76_dbg(DBG_MIB, "%s: MIB LOCAL: beacon_enable %d "
"txautorate_fallback %d ssid_size %d promiscuous_mode %d "
"preamble_type %d", priv->netdev->name, m->beacon_enable,
m->txautorate_fallback, m->ssid_size, m->promiscuous_mode,
m->preamble_type);
-error:
- kfree(m);
-exit:
- return ret;
-}
-
-static int at76_get_mib_mdomain(struct at76_priv *priv, struct mib_mdomain *val)
-{
- int ret = 0;
- struct mib_mdomain *mdomain =
- kmalloc(sizeof(struct mib_mdomain), GFP_KERNEL);
-
- if (!mdomain) {
- ret = -ENOMEM;
- goto exit;
- }
-
- ret = at76_get_mib(priv->udev, MIB_MDOMAIN, mdomain,
- sizeof(struct mib_mdomain));
- if (ret < 0)
- err("%s: at76_get_mib failed: %d", priv->netdev->name, ret);
- else
- memcpy(val, mdomain, sizeof(*val));
-
- kfree(mdomain);
-
exit:
- return ret;
+ kfree(m);
}
static void at76_dump_mib_mdomain(struct at76_priv *priv)
{
int ret;
- struct mib_mdomain mdomain;
+ struct mib_mdomain *m = kmalloc(sizeof(struct mib_mdomain), GFP_KERNEL);
- ret = at76_get_mib_mdomain(priv, &mdomain);
- if (ret < 0) {
- err("%s: at76_get_mib_mdomain returned %d", __func__, ret);
+ if (!m)
return;
+
+ ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m,
+ sizeof(struct mib_mdomain));
+ if (ret < 0) {
+ err("%s: at76_get_mib (MDOMAIN) failed: %d", priv->netdev->name,
+ ret);
+ goto exit;
}
at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s",
priv->netdev->name,
- hex2str(mdomain.channel_list, sizeof(mdomain.channel_list)));
+ hex2str(m->channel_list, sizeof(m->channel_list)));
at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: tx_powerlevel %s",
priv->netdev->name,
- hex2str(mdomain.tx_powerlevel, sizeof(mdomain.tx_powerlevel)));
+ hex2str(m->tx_powerlevel, sizeof(m->tx_powerlevel)));
+exit:
+ kfree(m);
}
static int at76_get_current_bssid(struct at76_priv *priv)
next prev parent reply other threads:[~2007-09-01 4:37 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-01 4:34 [PATCH 00/35] Update at76_usb to the start of mac80211 port Pavel Roskin
2007-09-01 4:34 ` [PATCH 01/35] Protect at76_get_op_mode() and at76_get_mib() against short reads Pavel Roskin
2007-09-01 4:34 ` [PATCH 02/35] Use existing macros to find bulk in and bulk out endpoints Pavel Roskin
2007-09-01 4:34 ` [PATCH 03/35] Rewrite at76_alloc_urbs() in a more linear fashion Pavel Roskin
2007-09-01 4:34 ` [PATCH 04/35] Avoid overuse of NULL Pavel Roskin
2007-09-01 4:34 ` [PATCH 05/35] Add myself to the author list Pavel Roskin
2007-09-01 4:34 ` [PATCH 06/35] Move (de)initialization functions closer to the end of file Pavel Roskin
2007-09-01 4:34 ` [PATCH 07/35] Don't use shift on numeric constants in usb_control_msg() arguments Pavel Roskin
2007-09-01 4:35 ` [PATCH 08/35] Merge at76_download_external_fw() into at76_load_external_fw() Pavel Roskin
2007-09-01 4:35 ` [PATCH 09/35] Simplify at76_usbdfu_download() Pavel Roskin
2007-09-01 4:35 ` [PATCH 10/35] Add minimal support to 505AMX Pavel Roskin
2007-09-01 4:35 ` [PATCH 11/35] Simplify logic in at76_get_reg_domain() Pavel Roskin
2007-09-01 4:35 ` [PATCH 12/35] Fix hex2str() and mac2str() to avoid buffer overlap Pavel Roskin
2007-09-01 4:35 ` [PATCH 13/35] Rename some long functions and fields Pavel Roskin
2007-09-01 4:35 ` [PATCH 14/35] Fix incorrect queue management in at76_tx_mgmt() Pavel Roskin
2007-09-01 4:35 ` [PATCH 15/35] Introduce at76_quiesce(), use it to stop network activity Pavel Roskin
2007-09-01 4:35 ` [PATCH 16/35] Don't disable and enable tasklets, it doesn't work as expected Pavel Roskin
2007-09-01 4:35 ` [PATCH 17/35] Start beacon timeout task when connected Pavel Roskin
2007-09-01 4:35 ` [PATCH 18/35] Only cancel correct timeouts for Auth and Assoc replies Pavel Roskin
2007-09-01 9:17 ` Johannes Berg
2007-09-01 10:54 ` Pavel Roskin
2007-09-01 11:04 ` Johannes Berg
2007-09-01 13:16 ` John W. Linville
2007-09-01 20:09 ` Pavel Roskin
2007-09-01 4:36 ` [PATCH 19/35] Improve output of the regdomain id Pavel Roskin
2007-09-01 4:36 ` [PATCH 20/35] Protect at76_iw_handler_set_scan() with mutex Pavel Roskin
2007-09-01 4:36 ` [PATCH 21/35] Eliminate vendor IDs Pavel Roskin
2007-09-01 4:36 ` [PATCH 22/35] Only retry resubmitting rx_urb once Pavel Roskin
2007-09-01 4:36 ` [PATCH 23/35] Simplify at76_get_mib_mdomain() Pavel Roskin
2007-09-01 4:36 ` [PATCH 24/35] Do implicit scanning only with current ESSID Pavel Roskin
2007-09-01 4:36 ` [PATCH 25/35] Don't dump mib_mdomain while scanning, it's done on device startup Pavel Roskin
2007-09-01 4:36 ` [PATCH 26/35] Improve dump of MAC_ADDR Pavel Roskin
2007-09-01 4:36 ` [PATCH 27/35] Remove unneeded braces, found by checkpatch.pl Pavel Roskin
2007-09-01 4:36 ` [PATCH 28/35] Convert dbg() to at76_dbg() or remove it Pavel Roskin
2007-09-01 4:37 ` [PATCH 29/35] Eliminate at76_dbg_dumpbuf() in favor of hex2str() Pavel Roskin
2007-09-01 4:37 ` [PATCH 30/35] Eliminate pr_debug() in favor of at76_dbg() Pavel Roskin
2007-09-01 4:37 ` [PATCH 31/35] Simplify logic in at76_is_hidden_ssid() Pavel Roskin
2007-09-01 4:37 ` Pavel Roskin [this message]
2007-09-01 4:37 ` [PATCH 33/35] Remove international roaming support Pavel Roskin
2007-09-01 4:37 ` [PATCH 34/35] Don't do additional MIB dumps if DEBUG is defined Pavel Roskin
2007-09-01 4:37 ` [PATCH 35/35] Replace scan_runs with scan_need_any Pavel Roskin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070901043717.2498.87983.stgit@dv.roinet.com \
--to=proski@gnu.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).