提交 34d102c9 编写于 作者: S Sujith Manoharan 提交者: Kalle Valo

ath9k: Simplify user pattern configuration

There is no need to allocate a new structure and
free it for every user pattern, instead use local
variables.
Signed-off-by: NSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 8b861715
...@@ -830,12 +830,6 @@ static inline void ath_fill_led_pin(struct ath_softc *sc) ...@@ -830,12 +830,6 @@ static inline void ath_fill_led_pin(struct ath_softc *sc)
/* Wake on Wireless LAN */ /* Wake on Wireless LAN */
/************************/ /************************/
struct ath9k_wow_pattern {
u8 pattern_bytes[MAX_PATTERN_SIZE];
u8 mask_bytes[MAX_PATTERN_SIZE];
u32 pattern_len;
};
#ifdef CONFIG_ATH9K_WOW #ifdef CONFIG_ATH9K_WOW
void ath9k_init_wow(struct ieee80211_hw *hw); void ath9k_init_wow(struct ieee80211_hw *hw);
void ath9k_deinit_wow(struct ieee80211_hw *hw); void ath9k_deinit_wow(struct ieee80211_hw *hw);
......
...@@ -128,50 +128,25 @@ static void ath9k_wow_add_pattern(struct ath_softc *sc, ...@@ -128,50 +128,25 @@ static void ath9k_wow_add_pattern(struct ath_softc *sc,
struct cfg80211_wowlan *wowlan) struct cfg80211_wowlan *wowlan)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
struct ath9k_wow_pattern *wow_pattern = NULL;
struct cfg80211_pkt_pattern *patterns = wowlan->patterns; struct cfg80211_pkt_pattern *patterns = wowlan->patterns;
u8 wow_pattern[MAX_PATTERN_SIZE];
u8 wow_mask[MAX_PATTERN_SIZE];
int mask_len; int mask_len;
s8 i = 0; s8 i = 0;
if (!wowlan->n_patterns)
return;
/*
* Add the new user configured patterns
*/
for (i = 0; i < wowlan->n_patterns; i++) { for (i = 0; i < wowlan->n_patterns; i++) {
mask_len = DIV_ROUND_UP(patterns[i].pattern_len, 8);
wow_pattern = kzalloc(sizeof(*wow_pattern), GFP_KERNEL); memset(wow_pattern, 0, MAX_PATTERN_SIZE);
memset(wow_mask, 0, MAX_PATTERN_SIZE);
if (!wow_pattern) memcpy(wow_pattern, patterns[i].pattern, patterns[i].pattern_len);
return; memcpy(wow_mask, patterns[i].mask, mask_len);
/* ath9k_hw_wow_apply_pattern(ah,
* TODO: convert the generic user space pattern to wow_pattern,
* appropriate chip specific/802.11 pattern. wow_mask,
*/
mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8);
memset(wow_pattern->pattern_bytes, 0, MAX_PATTERN_SIZE);
memset(wow_pattern->mask_bytes, 0, MAX_PATTERN_SIZE);
memcpy(wow_pattern->pattern_bytes, patterns[i].pattern,
patterns[i].pattern_len);
memcpy(wow_pattern->mask_bytes, patterns[i].mask, mask_len);
wow_pattern->pattern_len = patterns[i].pattern_len;
/*
* just need to take care of deauth and disssoc pattern,
* make sure we don't overwrite them.
*/
ath9k_hw_wow_apply_pattern(ah, wow_pattern->pattern_bytes,
wow_pattern->mask_bytes,
i + 2, i + 2,
wow_pattern->pattern_len); patterns[i].pattern_len);
kfree(wow_pattern);
} }
} }
int ath9k_suspend(struct ieee80211_hw *hw, int ath9k_suspend(struct ieee80211_hw *hw,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册