diff options
Diffstat (limited to 'drivers/net/wireless/atmel.c')
-rw-r--r-- | drivers/net/wireless/atmel.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 0c07b8b7250d..10bcb48e80d0 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -595,7 +595,7 @@ static void atmel_join_bss(struct atmel_private *priv, int bss_index); | |||
595 | static void atmel_smooth_qual(struct atmel_private *priv); | 595 | static void atmel_smooth_qual(struct atmel_private *priv); |
596 | static void atmel_writeAR(struct net_device *dev, u16 data); | 596 | static void atmel_writeAR(struct net_device *dev, u16 data); |
597 | static int probe_atmel_card(struct net_device *dev); | 597 | static int probe_atmel_card(struct net_device *dev); |
598 | static int reset_atmel_card(struct net_device *dev ); | 598 | static int reset_atmel_card(struct net_device *dev); |
599 | static void atmel_enter_state(struct atmel_private *priv, int new_state); | 599 | static void atmel_enter_state(struct atmel_private *priv, int new_state); |
600 | int atmel_open (struct net_device *dev); | 600 | int atmel_open (struct net_device *dev); |
601 | 601 | ||
@@ -784,11 +784,11 @@ static void tx_update_descriptor(struct atmel_private *priv, int is_bcast, | |||
784 | 784 | ||
785 | static int start_tx(struct sk_buff *skb, struct net_device *dev) | 785 | static int start_tx(struct sk_buff *skb, struct net_device *dev) |
786 | { | 786 | { |
787 | static const u8 SNAP_RFC1024[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | ||
787 | struct atmel_private *priv = netdev_priv(dev); | 788 | struct atmel_private *priv = netdev_priv(dev); |
788 | struct ieee80211_hdr_4addr header; | 789 | struct ieee80211_hdr_4addr header; |
789 | unsigned long flags; | 790 | unsigned long flags; |
790 | u16 buff, frame_ctl, len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN; | 791 | u16 buff, frame_ctl, len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN; |
791 | u8 SNAP_RFC1024[6] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; | ||
792 | 792 | ||
793 | if (priv->card && priv->present_callback && | 793 | if (priv->card && priv->present_callback && |
794 | !(*priv->present_callback)(priv->card)) { | 794 | !(*priv->present_callback)(priv->card)) { |
@@ -1193,7 +1193,7 @@ static irqreturn_t service_interrupt(int irq, void *dev_id) | |||
1193 | 1193 | ||
1194 | atmel_set_gcr(dev, GCR_ACKINT); /* acknowledge interrupt */ | 1194 | atmel_set_gcr(dev, GCR_ACKINT); /* acknowledge interrupt */ |
1195 | 1195 | ||
1196 | for (i = 0; i < sizeof(irq_order)/sizeof(u8); i++) | 1196 | for (i = 0; i < ARRAY_SIZE(irq_order); i++) |
1197 | if (isr & irq_order[i]) | 1197 | if (isr & irq_order[i]) |
1198 | break; | 1198 | break; |
1199 | 1199 | ||
@@ -1345,10 +1345,10 @@ int atmel_open(struct net_device *dev) | |||
1345 | atmel_set_mib8(priv, Phy_Mib_Type, PHY_MIB_REG_DOMAIN_POS, priv->reg_domain); | 1345 | atmel_set_mib8(priv, Phy_Mib_Type, PHY_MIB_REG_DOMAIN_POS, priv->reg_domain); |
1346 | } else { | 1346 | } else { |
1347 | priv->reg_domain = atmel_get_mib8(priv, Phy_Mib_Type, PHY_MIB_REG_DOMAIN_POS); | 1347 | priv->reg_domain = atmel_get_mib8(priv, Phy_Mib_Type, PHY_MIB_REG_DOMAIN_POS); |
1348 | for (i = 0; i < sizeof(channel_table)/sizeof(channel_table[0]); i++) | 1348 | for (i = 0; i < ARRAY_SIZE(channel_table); i++) |
1349 | if (priv->reg_domain == channel_table[i].reg_domain) | 1349 | if (priv->reg_domain == channel_table[i].reg_domain) |
1350 | break; | 1350 | break; |
1351 | if (i == sizeof(channel_table)/sizeof(channel_table[0])) { | 1351 | if (i == ARRAY_SIZE(channel_table)) { |
1352 | priv->reg_domain = REG_DOMAIN_MKK1; | 1352 | priv->reg_domain = REG_DOMAIN_MKK1; |
1353 | printk(KERN_ALERT "%s: failed to get regulatory domain: assuming MKK1.\n", dev->name); | 1353 | printk(KERN_ALERT "%s: failed to get regulatory domain: assuming MKK1.\n", dev->name); |
1354 | } | 1354 | } |
@@ -1393,7 +1393,7 @@ static int atmel_validate_channel(struct atmel_private *priv, int channel) | |||
1393 | else return suitable default channel */ | 1393 | else return suitable default channel */ |
1394 | int i; | 1394 | int i; |
1395 | 1395 | ||
1396 | for (i = 0; i < sizeof(channel_table)/sizeof(channel_table[0]); i++) | 1396 | for (i = 0; i < ARRAY_SIZE(channel_table); i++) |
1397 | if (priv->reg_domain == channel_table[i].reg_domain) { | 1397 | if (priv->reg_domain == channel_table[i].reg_domain) { |
1398 | if (channel >= channel_table[i].min && | 1398 | if (channel >= channel_table[i].min && |
1399 | channel <= channel_table[i].max) | 1399 | channel <= channel_table[i].max) |
@@ -1437,7 +1437,7 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) | |||
1437 | } | 1437 | } |
1438 | 1438 | ||
1439 | r = "<unknown>"; | 1439 | r = "<unknown>"; |
1440 | for (i = 0; i < sizeof(channel_table)/sizeof(channel_table[0]); i++) | 1440 | for (i = 0; i < ARRAY_SIZE(channel_table); i++) |
1441 | if (priv->reg_domain == channel_table[i].reg_domain) | 1441 | if (priv->reg_domain == channel_table[i].reg_domain) |
1442 | r = channel_table[i].name; | 1442 | r = channel_table[i].name; |
1443 | 1443 | ||
@@ -1736,7 +1736,7 @@ static int atmel_set_encode(struct net_device *dev, | |||
1736 | /* Disable the key */ | 1736 | /* Disable the key */ |
1737 | priv->wep_key_len[index] = 0; | 1737 | priv->wep_key_len[index] = 0; |
1738 | /* Check if the key is not marked as invalid */ | 1738 | /* Check if the key is not marked as invalid */ |
1739 | if(!(dwrq->flags & IW_ENCODE_NOKEY)) { | 1739 | if (!(dwrq->flags & IW_ENCODE_NOKEY)) { |
1740 | /* Cleanup */ | 1740 | /* Cleanup */ |
1741 | memset(priv->wep_keys[index], 0, 13); | 1741 | memset(priv->wep_keys[index], 0, 13); |
1742 | /* Copy the key in the driver */ | 1742 | /* Copy the key in the driver */ |
@@ -1907,7 +1907,7 @@ static int atmel_get_encodeext(struct net_device *dev, | |||
1907 | 1907 | ||
1908 | encoding->flags = idx + 1; | 1908 | encoding->flags = idx + 1; |
1909 | memset(ext, 0, sizeof(*ext)); | 1909 | memset(ext, 0, sizeof(*ext)); |
1910 | 1910 | ||
1911 | if (!priv->wep_is_on) { | 1911 | if (!priv->wep_is_on) { |
1912 | ext->alg = IW_ENCODE_ALG_NONE; | 1912 | ext->alg = IW_ENCODE_ALG_NONE; |
1913 | ext->key_len = 0; | 1913 | ext->key_len = 0; |
@@ -2343,6 +2343,14 @@ static int atmel_get_scan(struct net_device *dev, | |||
2343 | iwe.u.freq.e = 0; | 2343 | iwe.u.freq.e = 0; |
2344 | current_ev = iwe_stream_add_event(current_ev, extra + IW_SCAN_MAX_DATA, &iwe, IW_EV_FREQ_LEN); | 2344 | current_ev = iwe_stream_add_event(current_ev, extra + IW_SCAN_MAX_DATA, &iwe, IW_EV_FREQ_LEN); |
2345 | 2345 | ||
2346 | /* Add quality statistics */ | ||
2347 | iwe.cmd = IWEVQUAL; | ||
2348 | iwe.u.qual.level = priv->BSSinfo[i].RSSI; | ||
2349 | iwe.u.qual.qual = iwe.u.qual.level; | ||
2350 | /* iwe.u.qual.noise = SOMETHING */ | ||
2351 | current_ev = iwe_stream_add_event(current_ev, extra + IW_SCAN_MAX_DATA , &iwe, IW_EV_QUAL_LEN); | ||
2352 | |||
2353 | |||
2346 | iwe.cmd = SIOCGIWENCODE; | 2354 | iwe.cmd = SIOCGIWENCODE; |
2347 | if (priv->BSSinfo[i].UsingWEP) | 2355 | if (priv->BSSinfo[i].UsingWEP) |
2348 | iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; | 2356 | iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; |
@@ -2373,7 +2381,7 @@ static int atmel_get_range(struct net_device *dev, | |||
2373 | range->min_nwid = 0x0000; | 2381 | range->min_nwid = 0x0000; |
2374 | range->max_nwid = 0x0000; | 2382 | range->max_nwid = 0x0000; |
2375 | range->num_channels = 0; | 2383 | range->num_channels = 0; |
2376 | for (j = 0; j < sizeof(channel_table)/sizeof(channel_table[0]); j++) | 2384 | for (j = 0; j < ARRAY_SIZE(channel_table); j++) |
2377 | if (priv->reg_domain == channel_table[j].reg_domain) { | 2385 | if (priv->reg_domain == channel_table[j].reg_domain) { |
2378 | range->num_channels = channel_table[j].max - channel_table[j].min + 1; | 2386 | range->num_channels = channel_table[j].max - channel_table[j].min + 1; |
2379 | break; | 2387 | break; |
@@ -2579,9 +2587,9 @@ static const struct iw_priv_args atmel_private_args[] = { | |||
2579 | 2587 | ||
2580 | static const struct iw_handler_def atmel_handler_def = | 2588 | static const struct iw_handler_def atmel_handler_def = |
2581 | { | 2589 | { |
2582 | .num_standard = sizeof(atmel_handler)/sizeof(iw_handler), | 2590 | .num_standard = ARRAY_SIZE(atmel_handler), |
2583 | .num_private = sizeof(atmel_private_handler)/sizeof(iw_handler), | 2591 | .num_private = ARRAY_SIZE(atmel_private_handler), |
2584 | .num_private_args = sizeof(atmel_private_args)/sizeof(struct iw_priv_args), | 2592 | .num_private_args = ARRAY_SIZE(atmel_private_args), |
2585 | .standard = (iw_handler *) atmel_handler, | 2593 | .standard = (iw_handler *) atmel_handler, |
2586 | .private = (iw_handler *) atmel_private_handler, | 2594 | .private = (iw_handler *) atmel_private_handler, |
2587 | .private_args = (struct iw_priv_args *) atmel_private_args, | 2595 | .private_args = (struct iw_priv_args *) atmel_private_args, |
@@ -2645,7 +2653,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
2645 | 2653 | ||
2646 | domain[REGDOMAINSZ] = 0; | 2654 | domain[REGDOMAINSZ] = 0; |
2647 | rc = -EINVAL; | 2655 | rc = -EINVAL; |
2648 | for (i = 0; i < sizeof(channel_table)/sizeof(channel_table[0]); i++) { | 2656 | for (i = 0; i < ARRAY_SIZE(channel_table); i++) { |
2649 | /* strcasecmp doesn't exist in the library */ | 2657 | /* strcasecmp doesn't exist in the library */ |
2650 | char *a = channel_table[i].name; | 2658 | char *a = channel_table[i].name; |
2651 | char *b = domain; | 2659 | char *b = domain; |