79967250257e0d26389c1ddd000ba15c6dae4e4f
[openwrt.git] / package / kernel / mac80211 / patches / 311-ath9k-do-not-access-hardware-on-IRQs-during-reset.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Thu, 13 Nov 2014 18:29:26 +0100
3 Subject: [PATCH] ath9k: do not access hardware on IRQs during reset
4
5 Instead of killing interrupts during reset when the first one happens,
6 kill them before issuing the reset.
7 This fixes an easy to reproduce crash with multiple cards sharing the
8 same IRQ.
9
10 Cc: stable@vger.kernel.org
11 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 ---
13
14 --- a/drivers/net/wireless/ath/ath9k/main.c
15 +++ b/drivers/net/wireless/ath/ath9k/main.c
16 @@ -512,16 +512,13 @@ irqreturn_t ath_isr(int irq, void *dev)
17         if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags))
18                 return IRQ_NONE;
19  
20 -       /* shared irq, not for us */
21 +       if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
22 +               return IRQ_NONE;
23  
24 +       /* shared irq, not for us */
25         if (!ath9k_hw_intrpend(ah))
26                 return IRQ_NONE;
27  
28 -       if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) {
29 -               ath9k_hw_kill_interrupts(ah);
30 -               return IRQ_HANDLED;
31 -       }
32 -
33         /*
34          * Figure out the reason(s) for the interrupt.  Note
35          * that the hal returns a pseudo-ISR that may include
36 @@ -613,6 +610,7 @@ int ath_reset(struct ath_softc *sc, stru
37         struct ath_common *common = ath9k_hw_common(sc->sc_ah);
38         int r;
39  
40 +       ath9k_hw_kill_interrupts(sc->sc_ah);
41         set_bit(ATH_OP_HW_RESET, &common->op_flags);
42  
43         ath9k_ps_wakeup(sc);
44 @@ -633,6 +631,7 @@ void ath9k_queue_reset(struct ath_softc 
45  #ifdef CPTCFG_ATH9K_DEBUGFS
46         RESET_STAT_INC(sc, type);
47  #endif
48 +       ath9k_hw_kill_interrupts(sc->sc_ah);
49         set_bit(ATH_OP_HW_RESET, &common->op_flags);
50         ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
51  }