Skip to content

Commit

Permalink
ath9k: Remove ANI lock
Browse files Browse the repository at this point in the history
Cancel/restart the ANI timer directly.
With this patch, the ANI lock can be removed.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Sujith authored and John W. Linville committed Dec 22, 2009
1 parent 0ce024c commit 05c78d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
1 change: 0 additions & 1 deletion drivers/net/wireless/ath/ath9k/ath9k.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ struct ath_softc {
int irq;
spinlock_t sc_resetlock;
spinlock_t sc_serial_rw;
spinlock_t ani_lock;
spinlock_t sc_pm_lock;
struct mutex mutex;

Expand Down
19 changes: 4 additions & 15 deletions drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,6 @@ static void ath_ani_calibrate(unsigned long data)
short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ?
ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL;

/*
* don't calibrate when we're scanning.
* we are most likely not on our home channel.
*/
spin_lock(&sc->ani_lock);
if (sc->sc_flags & SC_OP_SCANNING)
goto set_timer;

/* Only calibrate if awake */
if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE)
goto set_timer;
Expand Down Expand Up @@ -437,7 +429,6 @@ static void ath_ani_calibrate(unsigned long data)
ath9k_ps_restore(sc);

set_timer:
spin_unlock(&sc->ani_lock);
/*
* Set timer interval based on previous results.
* The interval must be the shortest necessary to satisfy ANI,
Expand Down Expand Up @@ -1610,7 +1601,6 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
spin_lock_init(&sc->wiphy_lock);
spin_lock_init(&sc->sc_resetlock);
spin_lock_init(&sc->sc_serial_rw);
spin_lock_init(&sc->ani_lock);
spin_lock_init(&sc->sc_pm_lock);
mutex_init(&sc->mutex);
tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
Expand Down Expand Up @@ -3113,6 +3103,7 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
{
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);

mutex_lock(&sc->mutex);
if (ath9k_wiphy_scanning(sc)) {
Expand All @@ -3128,24 +3119,22 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw)

aphy->state = ATH_WIPHY_SCAN;
ath9k_wiphy_pause_all_forced(sc, aphy);

spin_lock_bh(&sc->ani_lock);
sc->sc_flags |= SC_OP_SCANNING;
spin_unlock_bh(&sc->ani_lock);
del_timer_sync(&common->ani.timer);
mutex_unlock(&sc->mutex);
}

static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
{
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);

mutex_lock(&sc->mutex);
spin_lock_bh(&sc->ani_lock);
aphy->state = ATH_WIPHY_ACTIVE;
sc->sc_flags &= ~SC_OP_SCANNING;
sc->sc_flags |= SC_OP_FULL_RESET;
spin_unlock_bh(&sc->ani_lock);
ath_start_ani(common);
ath_beacon_config(sc, NULL);
mutex_unlock(&sc->mutex);
}
Expand Down

0 comments on commit 05c78d6

Please sign in to comment.