Commit 1d382273 authored by Franky Lin's avatar Franky Lin Committed by John W. Linville

brcmfmac: use atomic variable for interrupt pending flag

Interrupt pending flag used in SDIO bus layer could be used in
multiple processes in different context. Use atomic_t make sure
every interrupt is handled.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 86761fcb
...@@ -531,7 +531,7 @@ struct brcmf_sdio { ...@@ -531,7 +531,7 @@ struct brcmf_sdio {
bool intr; /* Use interrupts */ bool intr; /* Use interrupts */
bool poll; /* Use polling */ bool poll; /* Use polling */
bool ipend; /* Device interrupt is pending */ atomic_t ipend; /* Device interrupt is pending */
uint spurious; /* Count of spurious interrupts */ uint spurious; /* Count of spurious interrupts */
uint pollrate; /* Ticks between device polls */ uint pollrate; /* Ticks between device polls */
uint polltick; /* Tick counter */ uint polltick; /* Tick counter */
...@@ -2151,7 +2151,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) ...@@ -2151,7 +2151,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes)
if (ret != 0) if (ret != 0)
break; break;
if (intstatus & bus->hostintmask) if (intstatus & bus->hostintmask)
bus->ipend = true; atomic_set(&bus->ipend, 1);
} }
} }
...@@ -2249,7 +2249,7 @@ static inline void brcmf_sdbrcm_clrintr(struct brcmf_sdio *bus) ...@@ -2249,7 +2249,7 @@ static inline void brcmf_sdbrcm_clrintr(struct brcmf_sdio *bus)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&bus->sdiodev->irq_en_lock, flags); spin_lock_irqsave(&bus->sdiodev->irq_en_lock, flags);
if (!bus->sdiodev->irq_en && !bus->ipend) { if (!bus->sdiodev->irq_en && !atomic_read(&bus->ipend)) {
enable_irq(bus->sdiodev->irq); enable_irq(bus->sdiodev->irq);
bus->sdiodev->irq_en = true; bus->sdiodev->irq_en = true;
} }
...@@ -2332,8 +2332,8 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2332,8 +2332,8 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
goto clkwait; goto clkwait;
/* Pending interrupt indicates new device status */ /* Pending interrupt indicates new device status */
if (bus->ipend) { if (atomic_read(&bus->ipend) > 0) {
bus->ipend = false; atomic_set(&bus->ipend, 0);
err = r_sdreg32(bus, &newstatus, err = r_sdreg32(bus, &newstatus,
offsetof(struct sdpcmd_regs, intstatus)); offsetof(struct sdpcmd_regs, intstatus));
bus->sdcnt.f1regdata++; bus->sdcnt.f1regdata++;
...@@ -2478,7 +2478,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) ...@@ -2478,7 +2478,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
} else if (bus->clkstate == CLK_PENDING) { } else if (bus->clkstate == CLK_PENDING) {
brcmf_dbg(INFO, "rescheduled due to CLK_PENDING awaiting I_CHIPACTIVE interrupt\n"); brcmf_dbg(INFO, "rescheduled due to CLK_PENDING awaiting I_CHIPACTIVE interrupt\n");
resched = true; resched = true;
} else if (bus->intstatus || bus->ipend || } else if (bus->intstatus || atomic_read(&bus->ipend) > 0 ||
(!bus->fcstate && brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) (!bus->fcstate && brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol)
&& data_ok(bus)) || PKT_AVAILABLE()) { && data_ok(bus)) || PKT_AVAILABLE()) {
resched = true; resched = true;
...@@ -3692,7 +3692,7 @@ void brcmf_sdbrcm_isr(void *arg) ...@@ -3692,7 +3692,7 @@ void brcmf_sdbrcm_isr(void *arg)
} }
/* Count the interrupt call */ /* Count the interrupt call */
bus->sdcnt.intrcount++; bus->sdcnt.intrcount++;
bus->ipend = true; atomic_set(&bus->ipend, 1);
/* Disable additional interrupts (is this needed now)? */ /* Disable additional interrupts (is this needed now)? */
if (!bus->intr) if (!bus->intr)
...@@ -3740,7 +3740,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) ...@@ -3740,7 +3740,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
schedule the DPC */ schedule the DPC */
if (intstatus) { if (intstatus) {
bus->sdcnt.pollcnt++; bus->sdcnt.pollcnt++;
bus->ipend = true; atomic_set(&bus->ipend, 1);
bus->dpc_sched = true; bus->dpc_sched = true;
if (bus->dpc_tsk) { if (bus->dpc_tsk) {
...@@ -3784,7 +3784,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) ...@@ -3784,7 +3784,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
up(&bus->sdsem); up(&bus->sdsem);
return bus->ipend; return (atomic_read(&bus->ipend) > 0);
} }
static bool brcmf_sdbrcm_chipmatch(u16 chipid) static bool brcmf_sdbrcm_chipmatch(u16 chipid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment