wlcore: clean-up clearing of WL1271_FLAG_IRQ_RUNNING
PATCH v3 1/1 wlcore: clean-up clearing of WL1271_FLAG_IRQ_RUNNING
We set WL1271_FLAG_IRQ_RUNNING in the beginning of wlcore_irq(), but clear it before interrupt handling is done in wlcore_irq_locked().
Let's move the clearing to the end of wlcore_irq() where it gets set, and remove the old comments about hardirq. That's no longer the case as we're using request_threaded_irq().
Note that the WL1271_FLAG_IRQ_RUNNING should never race between the interrupt handler and wlcore_runtime_resume() as because of autosuspend timeout we cannot enter idle between wlcore_irq_locked() and the end of wlcore_irq().
Changes since v2:
- Downgraded to clean-up from a fix as the race should never happen
Changes since v1:
- Add locking around clear_bit like we do elsewhere in the driver
--- drivers/net/wireless/ti/wlcore/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ti/wlcore/main.c +6 -6
@@ -544,11 +544,6 @@ static int wlcore_irq_locked(struct wl1271 *wl) }while (!done && loopcount--) { -/* -* In order to avoid a race with the hardirq, clear the flag -* before acknowledging the chip. -*/ -clear_bit (WL1271_FLAG_IRQ_RUNNING , &wl->flags);smp_mb__after_atomic (); ret =wlcore_fw_status (wl, wl->fw_status);
@@ -668,7 +663,7 @@ static irqreturn_t wlcore_irq(int irq, void *cookie)disable_irq_nosync (wl->irq);pm_wakeup_event (wl->dev,0 );spin_unlock_irqrestore (&wl->wl_lock, flags); -return IRQ_HANDLED ; + goto out_handled; }spin_unlock_irqrestore (&wl->wl_lock, flags);
@@ -692,6 +687,11 @@ static irqreturn_t wlcore_irq(int irq, void *cookie)mutex_unlock (&wl->mutex); +out_handled: +spin_lock_irqsave (&wl->wl_lock, flags); +clear_bit (WL1271_FLAG_IRQ_RUNNING , &wl->flags); +spin_unlock_irqrestore (&wl->wl_lock, flags); +return IRQ_HANDLED ; }
Signature · 1 line
2.23.0
A message that is not in the archive (sent off-list or not yet received): 20191009165006.41567-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org
Quoted 12 lines · Tony Lindgren
We set
WL1271_FLAG_IRQ_RUNNINGin the beginning ofwlcore_irq(), but clear it before interrupt handling is done inwlcore_irq_locked().Let's move the clearing to the end of
wlcore_irq()where it gets set, and remove the old comments about hardirq. That's no longer the case as we're usingrequest_threaded_irq().Note that the
WL1271_FLAG_IRQ_RUNNINGshould never race between the interrupt handler andwlcore_runtime_resume()as because of autosuspend timeout we cannot enter idle betweenwlcore_irq_locked()and the end ofwlcore_irq().
Quoted 6 lines
Cc Anders Roxell <[email protected]>Cc Eyal Reizer <[email protected]>Cc Guy Mishol <[email protected]>Cc John Stultz <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Tony Lindgren <[email protected]>
Patch applied to wireless-drivers-next.git, thanks.
4633d30b61ac wlcore: clean-up clearing of WL1271_FLAG_IRQ_RUNNING
Signature · 3 lines
https://patchwork.kernel.org/patch/11181621/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches