From: "Johan Adolfsson" <Johan.Adolfsson@axis.com>
To: <linux-wireless@vger.kernel.org>
Cc: "'Dan Williams'" <dcbw@redhat.com>,
"'Johan Adolfsson'" <johan.adolfsson@axis.com>
Subject: [PATCH] Add module parameter to override regioncode on libertas
Date: Mon, 30 Jun 2008 08:36:56 +0200 [thread overview]
Message-ID: <054201c8da7b$b12677e0$0137550a@se.axis.com> (raw)
In-Reply-To: <1214580776.10355.16.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 299 bytes --]
Resending to linux-wireless after positive feedback on libertas-dev.
Attached is a patch against the 2.6.25 driver that adds a
module parameter called "regioncode" to set the region code
in the libertas driver.
Hope the format is ok.
Signed-off-by: Johan.Adolfsson@axis.com
Best regards
/Johan
[-- Attachment #2: regioncode_patch.txt --]
[-- Type: text/plain, Size: 3177 bytes --]
Index: drivers/net/wireless/libertas/main.c
===================================================================
RCS file: /usr/local/cvs/linux/os/linux-2.6/drivers/net/wireless/libertas/main.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 main.c
--- drivers/net/wireless/libertas/main.c 2 Jun 2008 15:08:37 -0000 1.1.1.4
+++ drivers/net/wireless/libertas/main.c 27 Jun 2008 13:08:19 -0000
@@ -36,6 +36,9 @@
EXPORT_SYMBOL_GPL(lbs_debug);
module_param_named(libertas_debug, lbs_debug, int, 0644);
+static int lbs_regioncode;
+module_param_named(regioncode, lbs_regioncode, int, 0644);
+
#define LBS_TX_PWR_DEFAULT 20 /*100mW */
#define LBS_TX_PWR_US_DEFAULT 20 /*100mW */
@@ -936,9 +939,11 @@
lbs_deb_enter(LBS_DEB_FW);
/*
- * Read MAC address from HW
+ * Read MAC address and regioncode etc. from HW
*/
memset(priv->current_addr, 0xff, ETH_ALEN);
+ if (lbs_regioncode > 0)
+ priv->regioncode = lbs_regioncode;
ret = lbs_update_hw_spec(priv);
if (ret) {
ret = -1;
Index: drivers/net/wireless/libertas/cmd.c
===================================================================
RCS file: /usr/local/cvs/linux/os/linux-2.6/drivers/net/wireless/libertas/cmd.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 cmd.c
--- drivers/net/wireless/libertas/cmd.c 2 Jun 2008 15:08:37 -0000 1.1.1.4
+++ drivers/net/wireless/libertas/cmd.c 27 Jun 2008 13:08:19 -0000
@@ -81,22 +81,34 @@
lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n",
cmd.hwifversion, cmd.version);
- /* Clamp region code to 8-bit since FW spec indicates that it should
- * only ever be 8-bit, even though the field size is 16-bit. Some firmware
- * returns non-zero high 8 bits here.
- */
- priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF;
-
- for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
- /* use the region code to search for the index */
- if (priv->regioncode == lbs_region_code_to_index[i])
- break;
+ /* First check if a regioncode already provided */
+ if (priv->regioncode) {
+ for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
+ /* use the region code to search for the index */
+ if (priv->regioncode == lbs_region_code_to_index[i])
+ break;
+ }
+ } else {
+ i = MRVDRV_MAX_REGION_CODE; /* Check the from from cmd */
}
+ if (i >= MRVDRV_MAX_REGION_CODE) {
+ /* Clamp region code to 8-bit since FW spec indicates that it should
+ * only ever be 8-bit, even though the field size is 16-bit. Some firmware
+ * returns non-zero high 8 bits here.
+ */
+
+ priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF;
+ for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
+ /* use the region code to search for the index */
+ if (priv->regioncode == lbs_region_code_to_index[i])
+ break;
+ }
+ }
/* if it's unidentified region code, use the default (USA) */
if (i >= MRVDRV_MAX_REGION_CODE) {
+ lbs_pr_info("unidentified region code 0x%02x; using the default (USA)\n", priv->regioncode);
priv->regioncode = 0x10;
- lbs_pr_info("unidentified region code; using the default (USA)\n");
}
if (priv->current_addr[0] == 0xff)
next parent reply other threads:[~2008-06-30 6:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1214580776.10355.16.camel@localhost.localdomain>
2008-06-30 6:36 ` Johan Adolfsson [this message]
2008-06-30 11:05 ` [PATCH] Add module parameter to override regioncode on libertas Johannes Berg
2008-06-30 11:58 ` Johan Adolfsson
2008-06-30 14:03 ` John W. Linville
2008-06-30 15:44 ` Henrique de Moraes Holschuh
2008-06-30 17:29 ` John W. Linville
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='054201c8da7b$b12677e0$0137550a@se.axis.com' \
--to=johan.adolfsson@axis.com \
--cc=dcbw@redhat.com \
--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).