1 --- a/drivers/net/wireless/ath/ath9k/beacon.c
2 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
3 @@ -351,9 +351,7 @@ void ath_beacon_tasklet(unsigned long da
4 struct ath_buf *bf = NULL;
5 struct ieee80211_vif *vif;
7 - u32 bfaddr, bc = 0, tsftu;
13 * Check if the previous beacon has gone out. If
14 @@ -388,17 +386,27 @@ void ath_beacon_tasklet(unsigned long da
15 * on the tsf to safeguard against missing an swba.
18 - intval = cur_conf->beacon_interval ? : ATH_DEFAULT_BINTVAL;
20 - tsf = ath9k_hw_gettsf64(ah);
21 - tsf += TU_TO_USEC(ah->config.sw_beacon_response_time);
22 - tsftu = TSF_TO_TU((tsf * ATH_BCBUF) >>32, tsf * ATH_BCBUF);
23 - slot = (tsftu % (intval * ATH_BCBUF)) / intval;
24 - vif = sc->beacon.bslot[slot];
25 + if (ah->opmode == NL80211_IFTYPE_AP) {
30 + intval = cur_conf->beacon_interval ? : ATH_DEFAULT_BINTVAL;
31 + tsf = ath9k_hw_gettsf64(ah);
32 + tsf += TU_TO_USEC(ah->config.sw_beacon_response_time);
33 + tsftu = TSF_TO_TU((tsf * ATH_BCBUF) >>32, tsf * ATH_BCBUF);
34 + slot = (tsftu % (intval * ATH_BCBUF)) / intval;
35 + vif = sc->beacon.bslot[slot];
37 + ath_dbg(common, ATH_DBG_BEACON,
38 + "slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
39 + slot, tsf, tsftu / ATH_BCBUF, intval, vif);
42 + vif = sc->beacon.bslot[slot];
45 - ath_dbg(common, ATH_DBG_BEACON,
46 - "slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
47 - slot, tsf, tsftu / ATH_BCBUF, intval, vif);