Skip to content

Commit f18e3c6

Browse files
Mohammed Shafi Shajakhanlinvjw
authored andcommitted
ath9k_hw: avoid possible infinite loop in ar9003_get_pll_sqsum_dvc
"ath9k: Fix softlockup in AR9485" with commit id 64bc123 fixed the reported issue, yet its better to avoid the possible infinite loop in ar9003_get_pll_sqsum_dvc by having a timeout as suggested by ath9k maintainers. http://www.spinics.net/lists/linux-wireless/msg92126.html. Based on my testing PLL's locking measurement is done in ~200us (2 iterations). Cc: stable@vger.kernel.org Cc: Rolf Offermanns <rolf.offermanns@gmx.net> Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com> Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com> Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent a859e4d commit f18e3c6

File tree

1 file changed

+13
-1
lines changed
  • drivers/net/wireless/ath/ath9k

1 file changed

+13
-1
lines changed

drivers/net/wireless/ath/ath9k/hw.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,13 +784,25 @@ static void ath9k_hw_init_qos(struct ath_hw *ah)
784784

785785
u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah)
786786
{
787+
struct ath_common *common = ath9k_hw_common(ah);
788+
int i = 0;
789+
787790
REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK);
788791
udelay(100);
789792
REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK);
790793

791-
while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0)
794+
while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) {
795+
792796
udelay(100);
793797

798+
if (WARN_ON_ONCE(i >= 100)) {
799+
ath_err(common, "PLL4 meaurement not done\n");
800+
break;
801+
}
802+
803+
i++;
804+
}
805+
794806
return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3;
795807
}
796808
EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc);

0 commit comments

Comments
 (0)