ath9k: Fix max pattern check
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Fri, 30 Jan 2015 13:35:37 +0000 (19:05 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 3 Feb 2015 13:31:14 +0000 (15:31 +0200)
Since the maximum number of configurable patterns
is chip-specific, use the HW capability instead
of a fixed value for checking if a free pattern
slot is available.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath9k/ar9003_wow.c
drivers/net/wireless/ath/ath9k/hw.h
drivers/net/wireless/ath/ath9k/wow.c

index 6681a7b..d2a4f6f 100644 (file)
@@ -89,17 +89,16 @@ static void ath9k_wow_create_keep_alive_pattern(struct ath_hw *ah)
 
 }
 
-void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern,
-                               u8 *user_mask, int pattern_count,
-                               int pattern_len)
+int ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern,
+                              u8 *user_mask, int pattern_count,
+                              int pattern_len)
 {
        int i;
        u32 pattern_val, mask_val;
        u32 set, clr;
 
-       /* FIXME: should check count by querying the hardware capability */
-       if (pattern_count >= MAX_NUM_PATTERN)
-               return;
+       if (pattern_count >= ah->wow.max_patterns)
+               return -ENOSPC;
 
        REG_SET_BIT(ah, AR_WOW_PATTERN, BIT(pattern_count));
 
@@ -154,6 +153,7 @@ void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern,
                REG_RMW(ah, AR_WOW_LENGTH2, set, clr);
        }
 
+       return 0;
 }
 EXPORT_SYMBOL(ath9k_hw_wow_apply_pattern);
 
Simple merge
Simple merge