Commit fe041deb authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Kalle Valo

ath9k: use timespec64 for tsf_ts

ath9k is the last remaining user of the deprecated getrawmonotonic()
interface. There is nothing wrong with this usage, but migrating
to a timespec64 based interface lets us clean up the old API.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e4568eac
...@@ -342,7 +342,7 @@ struct ath_chanctx { ...@@ -342,7 +342,7 @@ struct ath_chanctx {
struct ath_beacon_config beacon; struct ath_beacon_config beacon;
struct ath9k_hw_cal_data caldata; struct ath9k_hw_cal_data caldata;
struct timespec tsf_ts; struct timespec64 tsf_ts;
u64 tsf_val; u64 tsf_val;
u32 last_beacon; u32 last_beacon;
...@@ -1021,7 +1021,7 @@ struct ath_softc { ...@@ -1021,7 +1021,7 @@ struct ath_softc {
struct ath_offchannel offchannel; struct ath_offchannel offchannel;
struct ath_chanctx *next_chan; struct ath_chanctx *next_chan;
struct completion go_beacon; struct completion go_beacon;
struct timespec last_event_time; struct timespec64 last_event_time;
#endif #endif
unsigned long driver_data; unsigned long driver_data;
......
...@@ -233,9 +233,9 @@ static const char *chanctx_state_string(enum ath_chanctx_state state) ...@@ -233,9 +233,9 @@ static const char *chanctx_state_string(enum ath_chanctx_state state)
static u32 chanctx_event_delta(struct ath_softc *sc) static u32 chanctx_event_delta(struct ath_softc *sc)
{ {
u64 ms; u64 ms;
struct timespec ts, *old; struct timespec64 ts, *old;
getrawmonotonic(&ts); ktime_get_raw_ts64(&ts);
old = &sc->last_event_time; old = &sc->last_event_time;
ms = ts.tv_sec * 1000 + ts.tv_nsec / 1000000; ms = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
ms -= old->tv_sec * 1000 + old->tv_nsec / 1000000; ms -= old->tv_sec * 1000 + old->tv_nsec / 1000000;
...@@ -334,7 +334,7 @@ ath_chanctx_get_next(struct ath_softc *sc, struct ath_chanctx *ctx) ...@@ -334,7 +334,7 @@ ath_chanctx_get_next(struct ath_softc *sc, struct ath_chanctx *ctx)
static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc) static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)
{ {
struct ath_chanctx *prev, *cur; struct ath_chanctx *prev, *cur;
struct timespec ts; struct timespec64 ts;
u32 cur_tsf, prev_tsf, beacon_int; u32 cur_tsf, prev_tsf, beacon_int;
s32 offset; s32 offset;
...@@ -346,7 +346,7 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc) ...@@ -346,7 +346,7 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)
if (!prev->switch_after_beacon) if (!prev->switch_after_beacon)
return; return;
getrawmonotonic(&ts); ktime_get_raw_ts64(&ts);
cur_tsf = (u32) cur->tsf_val + cur_tsf = (u32) cur->tsf_val +
ath9k_hw_get_tsf_offset(&cur->tsf_ts, &ts); ath9k_hw_get_tsf_offset(&cur->tsf_ts, &ts);
...@@ -1230,7 +1230,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force) ...@@ -1230,7 +1230,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)
{ {
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_chanctx *old_ctx; struct ath_chanctx *old_ctx;
struct timespec ts; struct timespec64 ts;
bool measure_time = false; bool measure_time = false;
bool send_ps = false; bool send_ps = false;
bool queues_stopped = false; bool queues_stopped = false;
...@@ -1260,7 +1260,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force) ...@@ -1260,7 +1260,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)
spin_unlock_bh(&sc->chan_lock); spin_unlock_bh(&sc->chan_lock);
if (sc->next_chan == &sc->offchannel.chan) { if (sc->next_chan == &sc->offchannel.chan) {
getrawmonotonic(&ts); ktime_get_raw_ts64(&ts);
measure_time = true; measure_time = true;
} }
...@@ -1277,7 +1277,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force) ...@@ -1277,7 +1277,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)
spin_lock_bh(&sc->chan_lock); spin_lock_bh(&sc->chan_lock);
if (sc->cur_chan != &sc->offchannel.chan) { if (sc->cur_chan != &sc->offchannel.chan) {
getrawmonotonic(&sc->cur_chan->tsf_ts); ktime_get_raw_ts64(&sc->cur_chan->tsf_ts);
sc->cur_chan->tsf_val = ath9k_hw_gettsf64(sc->sc_ah); sc->cur_chan->tsf_val = ath9k_hw_gettsf64(sc->sc_ah);
} }
} }
......
...@@ -1835,13 +1835,13 @@ static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -1835,13 +1835,13 @@ static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan)
return -EINVAL; return -EINVAL;
} }
u32 ath9k_hw_get_tsf_offset(struct timespec *last, struct timespec *cur) u32 ath9k_hw_get_tsf_offset(struct timespec64 *last, struct timespec64 *cur)
{ {
struct timespec ts; struct timespec64 ts;
s64 usec; s64 usec;
if (!cur) { if (!cur) {
getrawmonotonic(&ts); ktime_get_raw_ts64(&ts);
cur = &ts; cur = &ts;
} }
...@@ -1859,7 +1859,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, ...@@ -1859,7 +1859,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
u32 saveLedState; u32 saveLedState;
u32 saveDefAntenna; u32 saveDefAntenna;
u32 macStaId1; u32 macStaId1;
struct timespec tsf_ts; struct timespec64 tsf_ts;
u32 tsf_offset; u32 tsf_offset;
u64 tsf = 0; u64 tsf = 0;
int r; int r;
...@@ -1905,7 +1905,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, ...@@ -1905,7 +1905,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B; macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
/* Save TSF before chip reset, a cold reset clears it */ /* Save TSF before chip reset, a cold reset clears it */
getrawmonotonic(&tsf_ts); ktime_get_raw_ts64(&tsf_ts);
tsf = ath9k_hw_gettsf64(ah); tsf = ath9k_hw_gettsf64(ah);
saveLedState = REG_READ(ah, AR_CFG_LED) & saveLedState = REG_READ(ah, AR_CFG_LED) &
......
...@@ -1060,7 +1060,7 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah); ...@@ -1060,7 +1060,7 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah);
u64 ath9k_hw_gettsf64(struct ath_hw *ah); u64 ath9k_hw_gettsf64(struct ath_hw *ah);
void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
void ath9k_hw_reset_tsf(struct ath_hw *ah); void ath9k_hw_reset_tsf(struct ath_hw *ah);
u32 ath9k_hw_get_tsf_offset(struct timespec *last, struct timespec *cur); u32 ath9k_hw_get_tsf_offset(struct timespec64 *last, struct timespec64 *cur);
void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set); void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set);
void ath9k_hw_init_global_settings(struct ath_hw *ah); void ath9k_hw_init_global_settings(struct ath_hw *ah);
u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah);
......
...@@ -1865,7 +1865,7 @@ static void ath9k_set_tsf(struct ieee80211_hw *hw, ...@@ -1865,7 +1865,7 @@ static void ath9k_set_tsf(struct ieee80211_hw *hw,
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
tsf -= le64_to_cpu(avp->tsf_adjust); tsf -= le64_to_cpu(avp->tsf_adjust);
getrawmonotonic(&avp->chanctx->tsf_ts); ktime_get_raw_ts64(&avp->chanctx->tsf_ts);
if (sc->cur_chan == avp->chanctx) if (sc->cur_chan == avp->chanctx)
ath9k_hw_settsf64(sc->sc_ah, tsf); ath9k_hw_settsf64(sc->sc_ah, tsf);
avp->chanctx->tsf_val = tsf; avp->chanctx->tsf_val = tsf;
...@@ -1881,7 +1881,7 @@ static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -1881,7 +1881,7 @@ static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
getrawmonotonic(&avp->chanctx->tsf_ts); ktime_get_raw_ts64(&avp->chanctx->tsf_ts);
if (sc->cur_chan == avp->chanctx) if (sc->cur_chan == avp->chanctx)
ath9k_hw_reset_tsf(sc->sc_ah); ath9k_hw_reset_tsf(sc->sc_ah);
avp->chanctx->tsf_val = 0; avp->chanctx->tsf_val = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment