linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Schurig <holgerschurig@gmail.com>
To: linux-wireless@vger.kernel.org,
	John Linville <linville@tuxdriver.com>,
	Dan Williams <dcbw@redhat.com>
Subject: [PATCH] libertas: simplyfy lbs_set_regiontable()
Date: Thu, 26 Nov 2009 13:25:49 +0100	[thread overview]
Message-ID: <200911261325.49582.holgerschurig@gmail.com> (raw)

a) it's only called once
b) it get's called with band == 0, but setting a field in priv to 0 is
   superfluous (priv is kzalloc'ed anyway), so parameter "band" can go
   away
c) memsetting priv->regiontable is not necessary, too
d) it get's called with both priv and priv->regioncode, so the former
   parameter is superfluous

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>


--- linux-wl.orig/drivers/net/wireless/libertas/cmd.c
+++ linux-wl/drivers/net/wireless/libertas/cmd.c
@@ -174,7 +174,7 @@ int lbs_update_hw_spec(struct lbs_privat
 	if (priv->mesh_dev)
 		memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN);
 
-	if (lbs_set_regiontable(priv, priv->regioncode, 0)) {
+	if (lbs_set_regiontable(priv)) {
 		ret = -1;
 		goto out;
 	}
--- linux-wl.orig/drivers/net/wireless/libertas/scan.c
+++ linux-wl/drivers/net/wireless/libertas/scan.c
@@ -272,7 +272,7 @@ static struct chan_freq_power *lbs_get_r
 	return NULL;
 }
 
-int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band)
+int lbs_set_regiontable(struct lbs_private *priv)
 {
 	int ret = 0;
 	int i = 0;
@@ -282,21 +282,18 @@ int lbs_set_regiontable(struct lbs_priva
 
 	lbs_deb_enter(LBS_DEB_MAIN);
 
-	memset(priv->region_channel, 0, sizeof(priv->region_channel));
-
-	cfp = lbs_get_region_cfp_table(region, &cfp_no);
+	cfp = lbs_get_region_cfp_table(priv->regioncode, &cfp_no);
 	if (cfp != NULL) {
 		priv->region_channel[i].nrcfp = cfp_no;
 		priv->region_channel[i].CFP = cfp;
 	} else {
 		lbs_deb_main("wrong region code %#x in band B/G\n",
-		       region);
+		       priv->regioncode);
 		ret = -1;
 		goto out;
 	}
 	priv->region_channel[i].valid = 1;
-	priv->region_channel[i].region = region;
-	priv->region_channel[i].band = band;
+	priv->region_channel[i].region = priv->regioncode;
 	i++;
 out:
 	lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
--- linux-wl.orig/drivers/net/wireless/libertas/scan.h
+++ linux-wl/drivers/net/wireless/libertas/scan.h
@@ -46,7 +46,7 @@ struct region_channel {
 
 int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
 
-int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band);
+int lbs_set_regiontable(struct lbs_private *priv);
 
 int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid,
 				u8 ssid_len);

-- 
http://www.holgerschurig.de

                 reply	other threads:[~2009-11-26 12:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200911261325.49582.holgerschurig@gmail.com \
    --to=holgerschurig@gmail.com \
    --cc=dcbw@redhat.com \
    --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).