aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2012-04-16 19:16:54 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-01 03:13:00 -0400
commit0d7755e450865b76b98e3fea2e166b0a2266972d (patch)
treef8cd534b07f01aaf1e990ab3ca336c1f75adb46c
parent1c4f53ca32463a742583976f40444ce4485f3cf9 (diff)
mmc: sdio: avoid spurious calls to interrupt handlers
commit bbbc4c4d8c5face097d695f9bf3a39647ba6b7e7 upstream. Commit 06e8935feb ("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: Sujit Reddy Thumma <sthumma@codeaurora.org> Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/mmc/core/sdio.c2
-rw-r--r--drivers/mmc/core/sdio_irq.c11
-rw-r--r--include/linux/mmc/host.h2
3 files changed, 10 insertions, 5 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index ac492ac974e..9b18b541659 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -665,7 +665,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
665 } 665 }
666 666
667 if (!err && host->sdio_irqs) 667 if (!err && host->sdio_irqs)
668 mmc_signal_sdio_irq(host); 668 wake_up_process(host->sdio_irq_thread);
669 mmc_release_host(host); 669 mmc_release_host(host);
670 670
671 /* 671 /*
diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
index 03ead028d2c..d58ae915337 100644
--- a/drivers/mmc/core/sdio_irq.c
+++ b/drivers/mmc/core/sdio_irq.c
@@ -27,18 +27,20 @@
27 27
28#include "sdio_ops.h" 28#include "sdio_ops.h"
29 29
30static int process_sdio_pending_irqs(struct mmc_card *card) 30static int process_sdio_pending_irqs(struct mmc_host *host)
31{ 31{
32 struct mmc_card *card = host->card;
32 int i, ret, count; 33 int i, ret, count;
33 unsigned char pending; 34 unsigned char pending;
34 struct sdio_func *func; 35 struct sdio_func *func;
35 36
36 /* 37 /*
37 * Optimization, if there is only 1 function interrupt registered 38 * Optimization, if there is only 1 function interrupt registered
38 * call irq handler directly 39 * and we know an IRQ was signaled then call irq handler directly.
40 * Otherwise do the full probe.
39 */ 41 */
40 func = card->sdio_single_irq; 42 func = card->sdio_single_irq;
41 if (func) { 43 if (func && host->sdio_irq_pending) {
42 func->irq_handler(func); 44 func->irq_handler(func);
43 return 1; 45 return 1;
44 } 46 }
@@ -115,7 +117,8 @@ static int sdio_irq_thread(void *_host)
115 ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort); 117 ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort);
116 if (ret) 118 if (ret)
117 break; 119 break;
118 ret = process_sdio_pending_irqs(host->card); 120 ret = process_sdio_pending_irqs(host);
121 host->sdio_irq_pending = false;
119 mmc_release_host(host); 122 mmc_release_host(host);
120 123
121 /* 124 /*
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1ee4424462e..f8d1e741d80 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -267,6 +267,7 @@ struct mmc_host {
267 267
268 unsigned int sdio_irqs; 268 unsigned int sdio_irqs;
269 struct task_struct *sdio_irq_thread; 269 struct task_struct *sdio_irq_thread;
270 bool sdio_irq_pending;
270 atomic_t sdio_irq_thread_abort; 271 atomic_t sdio_irq_thread_abort;
271 272
272 mmc_pm_flag_t pm_flags; /* requested pm features */ 273 mmc_pm_flag_t pm_flags; /* requested pm features */
@@ -312,6 +313,7 @@ extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
312static inline void mmc_signal_sdio_irq(struct mmc_host *host) 313static inline void mmc_signal_sdio_irq(struct mmc_host *host)
313{ 314{
314 host->ops->enable_sdio_irq(host, 0); 315 host->ops->enable_sdio_irq(host, 0);
316 host->sdio_irq_pending = true;
315 wake_up_process(host->sdio_irq_thread); 317 wake_up_process(host->sdio_irq_thread);
316} 318}
317 319