summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>2003-07-17 08:19:14 -0300
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>2003-07-17 08:19:14 -0300
commitda2018e42de125fcfe71d5e27a8bea78c387a27f (patch)
tree330950a07ca8807200eec5239ddb5a8efce61db5 /drivers/net
parent0c3b11478df1c96e2527eeb287ee78eca41e9f64 (diff)
o wl3501: create iw_default_channel
Also aimed at being moved to the core wireless extensions code.
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl3501_cs.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 74fdd5f8bb24..e74d659a3f93 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -120,47 +120,55 @@ static int wl3501_chan2freq[] = {
static const struct {
int reg_domain;
- int min, max;
+ int min, max, deflt;
} iw_channel_table[] = {
{
.reg_domain = IW_REG_DOMAIN_FCC,
.min = 1,
.max = 11,
+ .deflt = 1,
},
{
.reg_domain = IW_REG_DOMAIN_DOC,
.min = 1,
.max = 11,
+ .deflt = 1,
},
{
.reg_domain = IW_REG_DOMAIN_ETSI,
.min = 1,
.max = 13,
+ .deflt = 1,
},
{
.reg_domain = IW_REG_DOMAIN_SPAIN,
.min = 10,
.max = 11,
+ .deflt = 10,
},
{
.reg_domain = IW_REG_DOMAIN_FRANCE,
.min = 10,
.max = 13,
+ .deflt = 10,
},
{
.reg_domain = IW_REG_DOMAIN_MKK,
.min = 14,
.max = 14,
+ .deflt = 14,
},
{
.reg_domain = IW_REG_DOMAIN_MKK1,
.min = 1,
.max = 14,
+ .deflt = 1,
},
{
.reg_domain = IW_REG_DOMAIN_ISRAEL,
.min = 3,
.max = 9,
+ .deflt = 9,
},
};
@@ -184,6 +192,24 @@ static int iw_valid_channel(int reg_domain, int channel)
return rc;
}
+/**
+ * iw_default_channel - get default channel for a regulatory domain
+ * @reg_comain - regulatory domain
+ *
+ * Returns the default channel for a regulatory domain
+ */
+static int iw_default_channel(int reg_domain)
+{
+ int i, rc = 1;
+
+ for (i = 0; i < ARRAY_SIZE(iw_channel_table); i++)
+ if (reg_domain == iw_channel_table[i].reg_domain) {
+ rc = iw_channel_table[i].deflt;
+ break;
+ }
+ return rc;
+}
+
/*
* A linked list of "instances" of the wl24 device. Each actual PCMCIA card
* corresponds to one device instance, and is described by one dev_link_t
@@ -2050,22 +2076,10 @@ static void wl3501_config(dev_link_t *link)
this->card_name[0] = '\0';
this->firmware_date[0] = '\0';
this->rssi = 255;
+ this->chan = iw_default_channel(this->reg_domain);
strlcpy(this->nick, "Planet WL3501", sizeof(this->nick));
spin_lock_init(&this->lock);
init_waitqueue_head(&this->wait);
-
- switch (this->reg_domain) {
- case IW_REG_DOMAIN_SPAIN:
- case IW_REG_DOMAIN_FRANCE:
- this->chan = 10;
- break;
- case IW_REG_DOMAIN_MKK:
- this->chan = 14;
- break;
- default:
- this->chan = 1;
- break;
- }
netif_start_queue(dev);
goto out;
cs_failed: