linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 04/26] at76_usb: Don't clean priv->mib_buf,  just clean data explicitly if needed
Date: Sun, 30 Sep 2007 14:39:04 -0400	[thread overview]
Message-ID: <20070930183904.23921.77202.stgit@tt.roinet.com> (raw)
In-Reply-To: <20070930183409.23921.97762.stgit@tt.roinet.com>

priv->mib_buf.reserved is 0 when priv is allocated, and stays 0.  When
setting ibss_change, set data[0] to 0.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 9044f3d..715b787 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -846,11 +846,9 @@ static int at76_set_pm_mode(struct at76_priv *priv)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC_MGMT;
 	priv->mib_buf.size = 1;
 	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, power_mgmt_mode);
-
 	priv->mib_buf.data[0] = priv->pm_mode;
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
@@ -866,11 +864,9 @@ static int at76_set_associd(struct at76_priv *priv, u16 id)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC_MGMT;
 	priv->mib_buf.size = 2;
 	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, station_id);
-
 	*(__le16 *)priv->mib_buf.data = cpu_to_le16(id);
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
@@ -886,11 +882,9 @@ static int at76_set_listen_interval(struct at76_priv *priv, u16 interval)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC;
 	priv->mib_buf.size = 2;
 	priv->mib_buf.index = offsetof(struct mib_mac, listen_interval);
-
 	*(__le16 *)priv->mib_buf.data = cpu_to_le16(interval);
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
@@ -905,11 +899,11 @@ static int at76_set_preamble(struct at76_priv *priv, u8 type)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_LOCAL;
 	priv->mib_buf.size = 1;
 	priv->mib_buf.index = offsetof(struct mib_local, preamble_type);
 	priv->mib_buf.data[0] = type;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (preamble) failed: %d", priv->netdev->name,
@@ -922,11 +916,11 @@ static int at76_set_frag(struct at76_priv *priv, u16 size)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC;
 	priv->mib_buf.size = 2;
 	priv->mib_buf.index = offsetof(struct mib_mac, frag_threshold);
 	*(__le16 *)priv->mib_buf.data = cpu_to_le16(size);
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (frag threshold) failed: %d",
@@ -939,11 +933,11 @@ static int at76_set_rts(struct at76_priv *priv, u16 size)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC;
 	priv->mib_buf.size = 2;
 	priv->mib_buf.index = offsetof(struct mib_mac, rts_threshold);
 	*(__le16 *)priv->mib_buf.data = cpu_to_le16(size);
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (rts) failed: %d", priv->netdev->name, ret);
@@ -955,11 +949,11 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_LOCAL;
 	priv->mib_buf.size = 1;
 	priv->mib_buf.index = offsetof(struct mib_local, txautorate_fallback);
 	priv->mib_buf.data[0] = onoff;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (autorate fallback) failed: %d",
@@ -986,11 +980,11 @@ static int at76_add_mac_address(struct at76_priv *priv, void *addr)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC_ADDR;
 	priv->mib_buf.size = ETH_ALEN;
 	priv->mib_buf.index = offsetof(struct mib_mac_addr, mac_addr);
 	memcpy(priv->mib_buf.data, addr, ETH_ALEN);
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (MAC_ADDR, mac_addr) failed: %d",
@@ -1006,24 +1000,24 @@ static int at76_set_group_address(struct at76_priv *priv, u8 *addr, int n)
 {
 	int ret = 0;
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC_ADDR;
 	priv->mib_buf.size = ETH_ALEN;
 	priv->mib_buf.index =
 	    offsetof(struct mib_mac_addr, group_addr) + n * ETH_ALEN;
 	memcpy(priv->mib_buf.data, addr, ETH_ALEN);
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (MIB_MAC_ADDR, group_addr) failed: %d",
 		    priv->netdev->name, ret);
 
 	/* I do not know anything about the group_addr_status field... (oku) */
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC_ADDR;
 	priv->mib_buf.size = 1;
 	priv->mib_buf.index =
 	    offsetof(struct mib_mac_addr, group_addr_status) + n;
 	priv->mib_buf.data[0] = 1;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (MIB_MAC_ADDR, group_addr_status) failed: %d",
@@ -1417,10 +1411,11 @@ static int at76_start_ibss(struct at76_priv *priv)
 		return ret;
 
 	/* not sure what this is good for ??? */
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC_MGMT;
 	priv->mib_buf.size = 1;
 	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, ibss_change);
+	priv->mib_buf.data[0] = 0;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0) {
 		err("%s: set_mib (ibss change ok) failed: %d",
@@ -3857,10 +3852,11 @@ static void at76_work_new_bss(struct work_struct *work)
 
 	at76_iwevent_bss_connect(priv->netdev, priv->bssid);
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_MAC_MGMT;
 	priv->mib_buf.size = 1;
 	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, ibss_change);
+	priv->mib_buf.data[0] = 0;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (ibss change ok) failed: %d", netdev->name,
@@ -4060,11 +4056,11 @@ static void at76_work_set_promisc(struct work_struct *work)
 
 	mutex_lock(&priv->mtx);
 
-	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 	priv->mib_buf.type = MIB_LOCAL;
 	priv->mib_buf.size = 1;
 	priv->mib_buf.index = offsetof(struct mib_local, promiscuous_mode);
 	priv->mib_buf.data[0] = priv->promisc ? 1 : 0;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (promiscuous_mode) failed: %d",

  parent reply	other threads:[~2007-09-30 18:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
2007-09-30 18:38 ` [PATCH 01/26] at76_usb: Use USB_DEVICE_DATA to improve readability of the device table Pavel Roskin
2007-09-30 18:38 ` [PATCH 02/26] at76_usb: Fix some device names in " Pavel Roskin
2007-09-30 18:38 ` [PATCH 03/26] at76_usb: Avoid dubious use of '\0' Pavel Roskin
2007-09-30 18:39 ` Pavel Roskin [this message]
2007-09-30 18:39 ` [PATCH 05/26] at76_usb: No need to reserve 72 bytes in set_mib_buffer - we only need 6 Pavel Roskin
2007-09-30 18:39 ` [PATCH 06/26] at76_usb: Fix turning radio off Pavel Roskin
2007-09-30 18:39 ` [PATCH 07/26] at76_usb: Integrate at76_set_monitor_mode() into at76_dwork_restart() Pavel Roskin
2007-09-30 18:39 ` [PATCH 08/26] at76_usb: Eliminate err(), it's USB specific Pavel Roskin
2007-09-30 18:39 ` [PATCH 09/26] at76_usb: Remove commented out code for multicast support Pavel Roskin
2007-09-30 18:39 ` [PATCH 10/26] at76_usb: Rename tlv to ie for readability Pavel Roskin
2007-09-30 18:39 ` [PATCH 11/26] at76_usb: Stop worrying about line termination in ethtool info Pavel Roskin
2007-09-30 18:39 ` [PATCH 12/26] at76_usb: Use string precision to avoid line termination Pavel Roskin
2007-09-30 18:40 ` [PATCH 13/26] at76_usb: Eliminate variables used only in at76_dbg() Pavel Roskin
2007-09-30 18:40 ` [PATCH 14/26] at76_usb: Make it clear that management frames are sent at 1Mbps Pavel Roskin
2007-09-30 18:40 ` [PATCH 15/26] at76_usb: Clean reserved tx area for mgmt frames like it's done for data Pavel Roskin
2007-09-30 18:40 ` [PATCH 16/26] at76_usb: Remove unneeded memset() calls Pavel Roskin
2007-09-30 18:40 ` [PATCH 17/26] at76_usb: Move some parts from at76_usb.h to at76_usb.c Pavel Roskin
2007-09-30 18:40 ` [PATCH 18/26] at76_usb: Avoid dealing with milliseconds when possible, use jiffies Pavel Roskin
2007-09-30 18:40 ` [PATCH 19/26] at76_usb: Add ID for Corega Wireless LAN USB-11 mini and mini2 Pavel Roskin
2007-09-30 18:40 ` [PATCH 20/26] at76_usb: Revert to network device names starting with "wlan" Pavel Roskin
2007-09-30 18:40 ` [PATCH 21/26] at76_usb: Remove incorrect firmware version check Pavel Roskin
2007-09-30 18:40 ` [PATCH 22/26] at76_usb: Use dev_printk() where possible Pavel Roskin
2007-09-30 18:41 ` [PATCH 23/26] at76_usb: Be more verbose on startup Pavel Roskin
2007-09-30 18:41 ` [PATCH 24/26] at76_usb: Use ETH_P_802_2 in monitor mode Pavel Roskin
2007-09-30 18:41 ` [PATCH 25/26] at76_usb: Bump version to 0.17 Pavel Roskin
2007-09-30 18:41 ` [PATCH 26/26] at76_usb: Add ID for at76c503a based CNETUSB611 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=20070930183904.23921.77202.stgit@tt.roinet.com \
    --to=proski@gnu.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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).