CHROMIUM: ath9k: Do not divide by zero cycle counter
authorPaul Stewart <pstew@chromium.org>
Fri, 27 Jul 2012 23:14:46 +0000 (16:14 -0700)
committerGerrit <chrome-bot@google.com>
Mon, 30 Jul 2012 15:48:59 +0000 (08:48 -0700)
cc_rxpoll.cycles can be zero under certain circumstances.
Skip this round of rx hang detection when this happens.

Signed-off-by: Paul Stewart <pstew@chromium.org>
BUG=chromium-os:32956
TEST=Reboot system.  Still waiting to see this message.

Change-Id: Id0a6d4b01137af4c36a27424615c30c52ed05fd8
Reviewed-on: https://gerrit.chromium.org/gerrit/28642
Reviewed-by: Simon Que <sque@chromium.org>
Reviewed-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
drivers/net/wireless/ath/ath9k/main.c

index 8066264..a48b25b 100644 (file)
@@ -728,6 +728,14 @@ void ath_rx_poll_work(unsigned long data)
        spin_lock_irqsave(&common->cc_lock, flags);
        ath_hw_cycle_counters_update(common);
 
+       if (common->cc_rxpoll.cycles == 0) {
+               spin_unlock_irqrestore(&common->cc_lock, flags);
+               ath_info(common, "rxpoll cycles is zero.  Skipping.");
+               ath9k_ps_restore(sc);
+               ath_start_rx_poll(sc, nmsec);
+               return;
+       }
+
        rx_clear = common->cc_rxpoll.rx_busy * 100 / common->cc_rxpoll.cycles;
        rx = common->cc_rxpoll.rx_frame * 100 / common->cc_rxpoll.cycles;
        tx = common->cc_rxpoll.tx_frame * 100 / common->cc_rxpoll.cycles;