aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-02-09 02:57:10 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:45:03 -0500
commitba52da58be0acf3b7775972b2b5234ce64388c79 (patch)
tree7663eb81791f4b85f56a6fa4c9119c954de7bc54 /drivers
parentd6bad496c6fbe3adb3323915a8b0430fa2955199 (diff)
ath9k: Remove duplicate variables
A few variables (bssid, bssidmask, curaid) were duplicated in struct ath_softc and in ath_hal, remove them. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath9k/ath9k.h1
-rw-r--r--drivers/net/wireless/ath9k/hw.c71
-rw-r--r--drivers/net/wireless/ath9k/hw.h14
-rw-r--r--drivers/net/wireless/ath9k/main.c24
-rw-r--r--drivers/net/wireless/ath9k/recv.c4
5 files changed, 38 insertions, 76 deletions
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index d60b2e72641..03e4d0bf159 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -580,7 +580,6 @@ struct ath_softc {
580 struct mutex mutex; 580 struct mutex mutex;
581 581
582 u8 curbssid[ETH_ALEN]; 582 u8 curbssid[ETH_ALEN];
583 u8 macaddr[ETH_ALEN];
584 u8 bssidmask[ETH_ALEN]; 583 u8 bssidmask[ETH_ALEN];
585 u32 intrstatus; 584 u32 intrstatus;
586 u32 sc_flags; /* SC_OP_* */ 585 u32 sc_flags; /* SC_OP_* */
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 9eafada743d..5d7287549c0 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -392,8 +392,6 @@ static struct ath_hal_5416 *ath9k_hw_newstate(u16 devid,
392 void __iomem *mem, 392 void __iomem *mem,
393 int *status) 393 int *status)
394{ 394{
395 static const u8 defbssidmask[ETH_ALEN] =
396 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
397 struct ath_hal_5416 *ahp; 395 struct ath_hal_5416 *ahp;
398 struct ath_hal *ah; 396 struct ath_hal *ah;
399 397
@@ -432,7 +430,6 @@ static struct ath_hal_5416 *ath9k_hw_newstate(u16 devid,
432 ahp->ah_acktimeout = (u32) -1; 430 ahp->ah_acktimeout = (u32) -1;
433 ahp->ah_ctstimeout = (u32) -1; 431 ahp->ah_ctstimeout = (u32) -1;
434 ahp->ah_globaltxtimeout = (u32) -1; 432 ahp->ah_globaltxtimeout = (u32) -1;
435 memcpy(&ahp->ah_bssidmask, defbssidmask, ETH_ALEN);
436 433
437 ahp->ah_gBeaconRate = 0; 434 ahp->ah_gBeaconRate = 0;
438 435
@@ -488,19 +485,18 @@ static int ath9k_hw_init_macaddr(struct ath_hal *ah)
488 u32 sum; 485 u32 sum;
489 int i; 486 int i;
490 u16 eeval; 487 u16 eeval;
491 struct ath_hal_5416 *ahp = AH5416(ah);
492 488
493 sum = 0; 489 sum = 0;
494 for (i = 0; i < 3; i++) { 490 for (i = 0; i < 3; i++) {
495 eeval = ath9k_hw_get_eeprom(ah, AR_EEPROM_MAC(i)); 491 eeval = ath9k_hw_get_eeprom(ah, AR_EEPROM_MAC(i));
496 sum += eeval; 492 sum += eeval;
497 ahp->ah_macaddr[2 * i] = eeval >> 8; 493 ah->macaddr[2 * i] = eeval >> 8;
498 ahp->ah_macaddr[2 * i + 1] = eeval & 0xff; 494 ah->macaddr[2 * i + 1] = eeval & 0xff;
499 } 495 }
500 if (sum == 0 || sum == 0xffff * 3) { 496 if (sum == 0 || sum == 0xffff * 3) {
501 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 497 DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
502 "mac address read failed: %pM\n", 498 "mac address read failed: %pM\n",
503 ahp->ah_macaddr); 499 ah->macaddr);
504 return -EADDRNOTAVAIL; 500 return -EADDRNOTAVAIL;
505 } 501 }
506 502
@@ -2251,8 +2247,8 @@ int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
2251 2247
2252 ath9k_hw_decrease_chain_power(ah, chan); 2248 ath9k_hw_decrease_chain_power(ah, chan);
2253 2249
2254 REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(ahp->ah_macaddr)); 2250 REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(ah->macaddr));
2255 REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(ahp->ah_macaddr + 4) 2251 REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(ah->macaddr + 4)
2256 | macStaId1 2252 | macStaId1
2257 | AR_STA_ID1_RTS_USE_DEF 2253 | AR_STA_ID1_RTS_USE_DEF
2258 | (ah->ah_config. 2254 | (ah->ah_config.
@@ -2260,14 +2256,14 @@ int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
2260 | ahp->ah_staId1Defaults); 2256 | ahp->ah_staId1Defaults);
2261 ath9k_hw_set_operating_mode(ah, ah->ah_opmode); 2257 ath9k_hw_set_operating_mode(ah, ah->ah_opmode);
2262 2258
2263 REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(ahp->ah_bssidmask)); 2259 REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(sc->bssidmask));
2264 REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(ahp->ah_bssidmask + 4)); 2260 REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(sc->bssidmask + 4));
2265 2261
2266 REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna); 2262 REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna);
2267 2263
2268 REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(ahp->ah_bssid)); 2264 REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(sc->curbssid));
2269 REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(ahp->ah_bssid + 4) | 2265 REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(sc->curbssid + 4) |
2270 ((ahp->ah_assocId & 0x3fff) << AR_BSS_ID1_AID_S)); 2266 ((sc->curaid & 0x3fff) << AR_BSS_ID1_AID_S));
2271 2267
2272 REG_WRITE(ah, AR_ISR, ~0); 2268 REG_WRITE(ah, AR_ISR, ~0);
2273 2269
@@ -3669,20 +3665,9 @@ bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit)
3669 return true; 3665 return true;
3670} 3666}
3671 3667
3672void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac) 3668void ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac)
3673{
3674 struct ath_hal_5416 *ahp = AH5416(ah);
3675
3676 memcpy(mac, ahp->ah_macaddr, ETH_ALEN);
3677}
3678
3679bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac)
3680{ 3669{
3681 struct ath_hal_5416 *ahp = AH5416(ah); 3670 memcpy(ah->macaddr, mac, ETH_ALEN);
3682
3683 memcpy(ahp->ah_macaddr, mac, ETH_ALEN);
3684
3685 return true;
3686} 3671}
3687 3672
3688void ath9k_hw_setopmode(struct ath_hal *ah) 3673void ath9k_hw_setopmode(struct ath_hal *ah)
@@ -3696,35 +3681,17 @@ void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1)
3696 REG_WRITE(ah, AR_MCAST_FIL1, filter1); 3681 REG_WRITE(ah, AR_MCAST_FIL1, filter1);
3697} 3682}
3698 3683
3699void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask) 3684void ath9k_hw_setbssidmask(struct ath_softc *sc)
3700{ 3685{
3701 struct ath_hal_5416 *ahp = AH5416(ah); 3686 REG_WRITE(sc->sc_ah, AR_BSSMSKL, get_unaligned_le32(sc->bssidmask));
3702 3687 REG_WRITE(sc->sc_ah, AR_BSSMSKU, get_unaligned_le16(sc->bssidmask + 4));
3703 memcpy(mask, ahp->ah_bssidmask, ETH_ALEN);
3704} 3688}
3705 3689
3706bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask) 3690void ath9k_hw_write_associd(struct ath_softc *sc)
3707{ 3691{
3708 struct ath_hal_5416 *ahp = AH5416(ah); 3692 REG_WRITE(sc->sc_ah, AR_BSS_ID0, get_unaligned_le32(sc->curbssid));
3709 3693 REG_WRITE(sc->sc_ah, AR_BSS_ID1, get_unaligned_le16(sc->curbssid + 4) |
3710 memcpy(ahp->ah_bssidmask, mask, ETH_ALEN); 3694 ((sc->curaid & 0x3fff) << AR_BSS_ID1_AID_S));
3711
3712 REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(ahp->ah_bssidmask));
3713 REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(ahp->ah_bssidmask + 4));
3714
3715 return true;
3716}
3717
3718void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId)
3719{
3720 struct ath_hal_5416 *ahp = AH5416(ah);
3721
3722 memcpy(ahp->ah_bssid, bssid, ETH_ALEN);
3723 ahp->ah_assocId = assocId;
3724
3725 REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(ahp->ah_bssid));
3726 REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(ahp->ah_bssid + 4) |
3727 ((assocId & 0x3fff) << AR_BSS_ID1_AID_S));
3728} 3695}
3729 3696
3730u64 ath9k_hw_gettsf64(struct ath_hal *ah) 3697u64 ath9k_hw_gettsf64(struct ath_hal *ah)
diff --git a/drivers/net/wireless/ath9k/hw.h b/drivers/net/wireless/ath9k/hw.h
index 3fdf9626a76..f4bf7021574 100644
--- a/drivers/net/wireless/ath9k/hw.h
+++ b/drivers/net/wireless/ath9k/hw.h
@@ -427,6 +427,7 @@ struct ath_hal {
427 struct ath9k_hw_capabilities ah_caps; 427 struct ath9k_hw_capabilities ah_caps;
428 struct ath9k_regulatory regulatory; 428 struct ath9k_regulatory regulatory;
429 u32 ah_flags; 429 u32 ah_flags;
430 u8 macaddr[ETH_ALEN];
430 431
431 enum ath9k_power_mode ah_power_mode; 432 enum ath9k_power_mode ah_power_mode;
432 enum ath9k_power_mode ah_restore_mode; 433 enum ath9k_power_mode ah_restore_mode;
@@ -457,11 +458,6 @@ struct ath_hal_5416 {
457 struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES]; 458 struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES];
458 void __iomem *ah_cal_mem; 459 void __iomem *ah_cal_mem;
459 460
460 u8 ah_macaddr[ETH_ALEN];
461 u8 ah_bssid[ETH_ALEN];
462 u8 ah_bssidmask[ETH_ALEN];
463 u16 ah_assocId;
464
465 int16_t ah_curchanRadIndex; 461 int16_t ah_curchanRadIndex;
466 u32 ah_maskReg; 462 u32 ah_maskReg;
467 u32 ah_txOkInterruptMask; 463 u32 ah_txOkInterruptMask;
@@ -633,13 +629,11 @@ void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits);
633bool ath9k_hw_phy_disable(struct ath_hal *ah); 629bool ath9k_hw_phy_disable(struct ath_hal *ah);
634bool ath9k_hw_disable(struct ath_hal *ah); 630bool ath9k_hw_disable(struct ath_hal *ah);
635bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit); 631bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit);
636void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac); 632void ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac);
637bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac);
638void ath9k_hw_setopmode(struct ath_hal *ah); 633void ath9k_hw_setopmode(struct ath_hal *ah);
639void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1); 634void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1);
640void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask); 635void ath9k_hw_setbssidmask(struct ath_softc *sc);
641bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask); 636void ath9k_hw_write_associd(struct ath_softc *sc);
642void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId);
643u64 ath9k_hw_gettsf64(struct ath_hal *ah); 637u64 ath9k_hw_gettsf64(struct ath_hal *ah);
644void ath9k_hw_settsf64(struct ath_hal *ah, u64 tsf64); 638void ath9k_hw_settsf64(struct ath_hal *ah, u64 tsf64);
645void ath9k_hw_reset_tsf(struct ath_hal *ah); 639void ath9k_hw_reset_tsf(struct ath_hal *ah);
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index a1c76ec09b3..bafefbed838 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -905,8 +905,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
905 /* New association, store aid */ 905 /* New association, store aid */
906 if (avp->av_opmode == NL80211_IFTYPE_STATION) { 906 if (avp->av_opmode == NL80211_IFTYPE_STATION) {
907 sc->curaid = bss_conf->aid; 907 sc->curaid = bss_conf->aid;
908 ath9k_hw_write_associd(sc->sc_ah, sc->curbssid, 908 ath9k_hw_write_associd(sc);
909 sc->curaid);
910 } 909 }
911 910
912 /* Configure the beacon */ 911 /* Configure the beacon */
@@ -1514,11 +1513,10 @@ static int ath_init(u16 devid, struct ath_softc *sc)
1514 ath9k_hw_setcapability(ah, ATH9K_CAP_DIVERSITY, 1, true, NULL); 1513 ath9k_hw_setcapability(ah, ATH9K_CAP_DIVERSITY, 1, true, NULL);
1515 sc->rx.defant = ath9k_hw_getdefantenna(ah); 1514 sc->rx.defant = ath9k_hw_getdefantenna(ah);
1516 1515
1517 ath9k_hw_getmac(ah, sc->macaddr);
1518 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) { 1516 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) {
1519 ath9k_hw_getbssidmask(ah, sc->bssidmask); 1517 memcpy(sc->bssidmask, ath_bcast_mac, ETH_ALEN);
1520 ATH_SET_VIF_BSSID_MASK(sc->bssidmask); 1518 ATH_SET_VIF_BSSID_MASK(sc->bssidmask);
1521 ath9k_hw_setbssidmask(ah, sc->bssidmask); 1519 ath9k_hw_setbssidmask(sc);
1522 } 1520 }
1523 1521
1524 sc->beacon.slottime = ATH9K_SLOT_TIME_9; /* default to short slot time */ 1522 sc->beacon.slottime = ATH9K_SLOT_TIME_9; /* default to short slot time */
@@ -1577,7 +1575,7 @@ int ath_attach(u16 devid, struct ath_softc *sc)
1577 1575
1578 /* get mac address from hardware and set in mac80211 */ 1576 /* get mac address from hardware and set in mac80211 */
1579 1577
1580 SET_IEEE80211_PERM_ADDR(hw, sc->macaddr); 1578 SET_IEEE80211_PERM_ADDR(hw, sc->sc_ah->macaddr);
1581 1579
1582 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | 1580 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
1583 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 1581 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
@@ -2285,7 +2283,9 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
2285 ah->ah_opmode != NL80211_IFTYPE_AP) { 2283 ah->ah_opmode != NL80211_IFTYPE_AP) {
2286 ah->ah_opmode = NL80211_IFTYPE_STATION; 2284 ah->ah_opmode = NL80211_IFTYPE_STATION;
2287 ath9k_hw_setopmode(ah); 2285 ath9k_hw_setopmode(ah);
2288 ath9k_hw_write_associd(ah, sc->macaddr, 0); 2286 memcpy(sc->curbssid, sc->sc_ah->macaddr, ETH_ALEN);
2287 sc->curaid = 0;
2288 ath9k_hw_write_associd(sc);
2289 /* Request full reset to get hw opmode changed properly */ 2289 /* Request full reset to get hw opmode changed properly */
2290 sc->sc_flags |= SC_OP_FULL_RESET; 2290 sc->sc_flags |= SC_OP_FULL_RESET;
2291 } 2291 }
@@ -2298,8 +2298,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
2298 /* Set BSSID */ 2298 /* Set BSSID */
2299 memcpy(sc->curbssid, conf->bssid, ETH_ALEN); 2299 memcpy(sc->curbssid, conf->bssid, ETH_ALEN);
2300 sc->curaid = 0; 2300 sc->curaid = 0;
2301 ath9k_hw_write_associd(sc->sc_ah, sc->curbssid, 2301 ath9k_hw_write_associd(sc);
2302 sc->curaid);
2303 2302
2304 /* Set aggregation protection mode parameters */ 2303 /* Set aggregation protection mode parameters */
2305 sc->config.ath_aggr_prot = 0; 2304 sc->config.ath_aggr_prot = 0;
@@ -2382,8 +2381,11 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw,
2382 ath9k_hw_setrxfilter(sc->sc_ah, rfilt); 2381 ath9k_hw_setrxfilter(sc->sc_ah, rfilt);
2383 2382
2384 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { 2383 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
2385 if (*total_flags & FIF_BCN_PRBRESP_PROMISC) 2384 if (*total_flags & FIF_BCN_PRBRESP_PROMISC) {
2386 ath9k_hw_write_associd(sc->sc_ah, ath_bcast_mac, 0); 2385 memcpy(sc->curbssid, ath_bcast_mac, ETH_ALEN);
2386 sc->curaid = 0;
2387 ath9k_hw_write_associd(sc);
2388 }
2387 } 2389 }
2388 2390
2389 DPRINTF(sc, ATH_DBG_CONFIG, "Set HW RX filter: 0x%x\n", sc->rx.rxfilter); 2391 DPRINTF(sc, ATH_DBG_CONFIG, "Set HW RX filter: 0x%x\n", sc->rx.rxfilter);
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index e8e4a32037f..c51c085f55d 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -242,13 +242,13 @@ static void ath_opmode_init(struct ath_softc *sc)
242 242
243 /* configure bssid mask */ 243 /* configure bssid mask */
244 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) 244 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
245 ath9k_hw_setbssidmask(ah, sc->bssidmask); 245 ath9k_hw_setbssidmask(sc);
246 246
247 /* configure operational mode */ 247 /* configure operational mode */
248 ath9k_hw_setopmode(ah); 248 ath9k_hw_setopmode(ah);
249 249
250 /* Handle any link-level address change. */ 250 /* Handle any link-level address change. */
251 ath9k_hw_setmac(ah, sc->macaddr); 251 ath9k_hw_setmac(ah, sc->sc_ah->macaddr);
252 252
253 /* calculate and install multicast filter */ 253 /* calculate and install multicast filter */
254 mfilt[0] = mfilt[1] = ~0; 254 mfilt[0] = mfilt[1] = ~0;