aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Achirica <achirica@gmail.com>2006-01-17 08:01:01 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-17 08:01:01 -0500
commit2610c733023850be2db9fef9c81f851a64bb9f67 (patch)
tree62db077203a86e8b67cde10941f7034caed02c4e
parent38bd3b2629702894ca3528358ffc447bbacc9442 (diff)
airo: Off-by-one channel fix
-rw-r--r--drivers/net/wireless/airo.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 65057348838b..a4c7ae94614d 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5668,13 +5668,13 @@ static int airo_set_freq(struct net_device *dev,
5668 int channel = fwrq->m; 5668 int channel = fwrq->m;
5669 /* We should do a better check than that, 5669 /* We should do a better check than that,
5670 * based on the card capability !!! */ 5670 * based on the card capability !!! */
5671 if((channel < 1) || (channel > 16)) { 5671 if((channel < 1) || (channel > 14)) {
5672 printk(KERN_DEBUG "%s: New channel value of %d is invalid!\n", dev->name, fwrq->m); 5672 printk(KERN_DEBUG "%s: New channel value of %d is invalid!\n", dev->name, fwrq->m);
5673 rc = -EINVAL; 5673 rc = -EINVAL;
5674 } else { 5674 } else {
5675 readConfigRid(local, 1); 5675 readConfigRid(local, 1);
5676 /* Yes ! We can set it !!! */ 5676 /* Yes ! We can set it !!! */
5677 local->config.channelSet = (u16)(channel - 1); 5677 local->config.channelSet = (u16) channel;
5678 set_bit (FLAG_COMMIT, &local->flags); 5678 set_bit (FLAG_COMMIT, &local->flags);
5679 } 5679 }
5680 } 5680 }
@@ -5692,6 +5692,7 @@ static int airo_get_freq(struct net_device *dev,
5692{ 5692{
5693 struct airo_info *local = dev->priv; 5693 struct airo_info *local = dev->priv;
5694 StatusRid status_rid; /* Card status info */ 5694 StatusRid status_rid; /* Card status info */
5695 int ch;
5695 5696
5696 readConfigRid(local, 1); 5697 readConfigRid(local, 1);
5697 if ((local->config.opmode & 0xFF) == MODE_STA_ESS) 5698 if ((local->config.opmode & 0xFF) == MODE_STA_ESS)
@@ -5699,16 +5700,14 @@ static int airo_get_freq(struct net_device *dev,
5699 else 5700 else
5700 readStatusRid(local, &status_rid, 1); 5701 readStatusRid(local, &status_rid, 1);
5701 5702
5702#ifdef WEXT_USECHANNELS 5703 ch = (int)status_rid.channel;
5703 fwrq->m = ((int)status_rid.channel) + 1; 5704 if((ch > 0) && (ch < 15)) {
5704 fwrq->e = 0; 5705 fwrq->m = frequency_list[ch - 1] * 100000;
5705#else
5706 {
5707 int f = (int)status_rid.channel;
5708 fwrq->m = frequency_list[f] * 100000;
5709 fwrq->e = 1; 5706 fwrq->e = 1;
5707 } else {
5708 fwrq->m = ch;
5709 fwrq->e = 0;
5710 } 5710 }
5711#endif
5712 5711
5713 return 0; 5712 return 0;
5714} 5713}