Commit bbbc4c4d authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Chris Ball

mmc: sdio: avoid spurious calls to interrupt handlers

Commit 06e8935f ("optimized SDIO IRQ handling for single irq")
introduced some spurious calls to SDIO function interrupt handlers,
such as when the SDIO IRQ thread is started, or the safety check
performed upon a system resume.  Let's add a flag to perform the
optimization only when a real interrupt is signaled by the host
driver and we know there is no point confirming it.
Reported-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 6187fee4
...@@ -947,7 +947,7 @@ static int mmc_sdio_resume(struct mmc_host *host) ...@@ -947,7 +947,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
} }
if (!err && host->sdio_irqs) if (!err && host->sdio_irqs)
mmc_signal_sdio_irq(host); wake_up_process(host->sdio_irq_thread);
mmc_release_host(host); mmc_release_host(host);
/* /*
......
...@@ -28,18 +28,20 @@ ...@@ -28,18 +28,20 @@
#include "sdio_ops.h" #include "sdio_ops.h"
static int process_sdio_pending_irqs(struct mmc_card *card) static int process_sdio_pending_irqs(struct mmc_host *host)
{ {
struct mmc_card *card = host->card;
int i, ret, count; int i, ret, count;
unsigned char pending; unsigned char pending;
struct sdio_func *func; struct sdio_func *func;
/* /*
* Optimization, if there is only 1 function interrupt registered * Optimization, if there is only 1 function interrupt registered
* call irq handler directly * and we know an IRQ was signaled then call irq handler directly.
* Otherwise do the full probe.
*/ */
func = card->sdio_single_irq; func = card->sdio_single_irq;
if (func) { if (func && host->sdio_irq_pending) {
func->irq_handler(func); func->irq_handler(func);
return 1; return 1;
} }
...@@ -116,7 +118,8 @@ static int sdio_irq_thread(void *_host) ...@@ -116,7 +118,8 @@ static int sdio_irq_thread(void *_host)
ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort); ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort);
if (ret) if (ret)
break; break;
ret = process_sdio_pending_irqs(host->card); ret = process_sdio_pending_irqs(host);
host->sdio_irq_pending = false;
mmc_release_host(host); mmc_release_host(host);
/* /*
......
...@@ -297,6 +297,7 @@ struct mmc_host { ...@@ -297,6 +297,7 @@ struct mmc_host {
unsigned int sdio_irqs; unsigned int sdio_irqs;
struct task_struct *sdio_irq_thread; struct task_struct *sdio_irq_thread;
bool sdio_irq_pending;
atomic_t sdio_irq_thread_abort; atomic_t sdio_irq_thread_abort;
mmc_pm_flag_t pm_flags; /* requested pm features */ mmc_pm_flag_t pm_flags; /* requested pm features */
...@@ -352,6 +353,7 @@ extern int mmc_cache_ctrl(struct mmc_host *, u8); ...@@ -352,6 +353,7 @@ extern int mmc_cache_ctrl(struct mmc_host *, u8);
static inline void mmc_signal_sdio_irq(struct mmc_host *host) static inline void mmc_signal_sdio_irq(struct mmc_host *host)
{ {
host->ops->enable_sdio_irq(host, 0); host->ops->enable_sdio_irq(host, 0);
host->sdio_irq_pending = true;
wake_up_process(host->sdio_irq_thread); wake_up_process(host->sdio_irq_thread);
} }
......
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