Commit 705d0bf8 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k: Add a routine for initializing channel contexts

Setup the offchannel/sched timers and the chanctx work
inside the new function.
Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 69e2a771
...@@ -422,7 +422,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx, ...@@ -422,7 +422,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,
void ath_chanctx_switch(struct ath_softc *sc, struct ath_chanctx *ctx, void ath_chanctx_switch(struct ath_softc *sc, struct ath_chanctx *ctx,
struct cfg80211_chan_def *chandef); struct cfg80211_chan_def *chandef);
void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx); void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx);
void ath_offchannel_timer(unsigned long data);
void ath_offchannel_channel_change(struct ath_softc *sc); void ath_offchannel_channel_change(struct ath_softc *sc);
void ath_chanctx_offchan_switch(struct ath_softc *sc, void ath_chanctx_offchan_switch(struct ath_softc *sc,
struct ieee80211_channel *chan); struct ieee80211_channel *chan);
...@@ -430,7 +429,6 @@ struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc, ...@@ -430,7 +429,6 @@ struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc,
bool active); bool active);
void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif, void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
enum ath_chanctx_event ev); enum ath_chanctx_event ev);
void ath_chanctx_timer(unsigned long data);
void ath_offchannel_next(struct ath_softc *sc); void ath_offchannel_next(struct ath_softc *sc);
void ath_scan_complete(struct ath_softc *sc, bool abort); void ath_scan_complete(struct ath_softc *sc, bool abort);
void ath_roc_complete(struct ath_softc *sc, bool abort); void ath_roc_complete(struct ath_softc *sc, bool abort);
...@@ -438,6 +436,7 @@ void ath_roc_complete(struct ath_softc *sc, bool abort); ...@@ -438,6 +436,7 @@ void ath_roc_complete(struct ath_softc *sc, bool abort);
#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
bool ath9k_is_chanctx_enabled(void); bool ath9k_is_chanctx_enabled(void);
void ath9k_fill_chanctx_ops(void); void ath9k_fill_chanctx_ops(void);
void ath9k_init_channel_context(struct ath_softc *sc);
int ath9k_init_p2p(struct ath_softc *sc); int ath9k_init_p2p(struct ath_softc *sc);
void ath9k_deinit_p2p(struct ath_softc *sc); void ath9k_deinit_p2p(struct ath_softc *sc);
void ath9k_p2p_remove_vif(struct ath_softc *sc, void ath9k_p2p_remove_vif(struct ath_softc *sc,
...@@ -454,6 +453,9 @@ static inline bool ath9k_is_chanctx_enabled(void) ...@@ -454,6 +453,9 @@ static inline bool ath9k_is_chanctx_enabled(void)
static inline void ath9k_fill_chanctx_ops(void) static inline void ath9k_fill_chanctx_ops(void)
{ {
} }
static inline void ath9k_init_channel_context(struct ath_softc *sc)
{
}
static inline int ath9k_init_p2p(struct ath_softc *sc) static inline int ath9k_init_p2p(struct ath_softc *sc)
{ {
return 0; return 0;
......
...@@ -499,13 +499,6 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc) ...@@ -499,13 +499,6 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)
prev->tsf_val += offset; prev->tsf_val += offset;
} }
void ath_chanctx_timer(unsigned long data)
{
struct ath_softc *sc = (struct ath_softc *) data;
ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_TSF_TIMER);
}
/* Configure the TSF based hardware timer for a channel switch. /* Configure the TSF based hardware timer for a channel switch.
* Also set up backup software timer, in case the gen timer fails. * Also set up backup software timer, in case the gen timer fails.
* This could be caused by a hardware reset. * This could be caused by a hardware reset.
...@@ -907,7 +900,16 @@ void ath_offchannel_channel_change(struct ath_softc *sc) ...@@ -907,7 +900,16 @@ void ath_offchannel_channel_change(struct ath_softc *sc)
} }
} }
void ath_offchannel_timer(unsigned long data) #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
static void ath_chanctx_timer(unsigned long data)
{
struct ath_softc *sc = (struct ath_softc *) data;
ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_TSF_TIMER);
}
static void ath_offchannel_timer(unsigned long data)
{ {
struct ath_softc *sc = (struct ath_softc *)data; struct ath_softc *sc = (struct ath_softc *)data;
struct ath_chanctx *ctx; struct ath_chanctx *ctx;
...@@ -947,7 +949,15 @@ void ath_offchannel_timer(unsigned long data) ...@@ -947,7 +949,15 @@ void ath_offchannel_timer(unsigned long data)
} }
} }
#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT void ath9k_init_channel_context(struct ath_softc *sc)
{
INIT_WORK(&sc->chanctx_work, ath_chanctx_work);
setup_timer(&sc->offchannel.timer, ath_offchannel_timer,
(unsigned long)sc);
setup_timer(&sc->sched.timer, ath_chanctx_timer,
(unsigned long)sc);
}
bool ath9k_is_chanctx_enabled(void) bool ath9k_is_chanctx_enabled(void)
{ {
......
...@@ -571,11 +571,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, ...@@ -571,11 +571,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
setup_timer(&sc->sleep_timer, ath_ps_full_sleep, (unsigned long)sc); setup_timer(&sc->sleep_timer, ath_ps_full_sleep, (unsigned long)sc);
INIT_WORK(&sc->hw_reset_work, ath_reset_work); INIT_WORK(&sc->hw_reset_work, ath_reset_work);
INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
INIT_WORK(&sc->chanctx_work, ath_chanctx_work);
INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
setup_timer(&sc->offchannel.timer, ath_offchannel_timer,
(unsigned long)sc); ath9k_init_channel_context(sc);
setup_timer(&sc->sched.timer, ath_chanctx_timer, (unsigned long)sc);
/* /*
* Cache line size is used to size and align various * Cache line size is used to size and align various
......
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