aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2012-04-16 19:16:54 -0400
committerChris Ball <cjb@laptop.org>2012-04-22 11:17:28 -0400
commitbbbc4c4d8c5face097d695f9bf3a39647ba6b7e7 (patch)
treea55ffe74b967001e3f52cc331a65974415470a45
parent6187fee46f4bc7f18f2caefdc75a073c6a25adab (diff)
mmc: sdio: avoid spurious calls to interrupt handlers
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> Cc: stable <stable@vger.kernel.org> Signed-off-by: Chris Ball <cjb@laptop.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 2c7c83f832d2..13d0e95380ab 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -947,7 +947,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
947 } 947 }
948 948
949 if (!err && host->sdio_irqs) 949 if (!err && host->sdio_irqs)
950 mmc_signal_sdio_irq(host); 950 wake_up_process(host->sdio_irq_thread);
951 mmc_release_host(host); 951 mmc_release_host(host);
952 952
953 /* 953 /*
diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
index f573e7f9f740..3d8ceb4084de 100644
--- a/drivers/mmc/core/sdio_irq.c
+++ b/drivers/mmc/core/sdio_irq.c
@@ -28,18 +28,20 @@
28 28
29#include "sdio_ops.h" 29#include "sdio_ops.h"
30 30
31static int process_sdio_pending_irqs(struct mmc_card *card) 31static int process_sdio_pending_irqs(struct mmc_host *host)
32{ 32{
33 struct mmc_card *card = host->card;
33 int i, ret, count; 34 int i, ret, count;
34 unsigned char pending; 35 unsigned char pending;
35 struct sdio_func *func; 36 struct sdio_func *func;
36 37
37 /* 38 /*
38 * Optimization, if there is only 1 function interrupt registered 39 * Optimization, if there is only 1 function interrupt registered
39 * call irq handler directly 40 * and we know an IRQ was signaled then call irq handler directly.
41 * Otherwise do the full probe.
40 */ 42 */
41 func = card->sdio_single_irq; 43 func = card->sdio_single_irq;
42 if (func) { 44 if (func && host->sdio_irq_pending) {
43 func->irq_handler(func); 45 func->irq_handler(func);
44 return 1; 46 return 1;
45 } 47 }
@@ -116,7 +118,8 @@ static int sdio_irq_thread(void *_host)
116 ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort); 118 ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort);
117 if (ret) 119 if (ret)
118 break; 120 break;
119 ret = process_sdio_pending_irqs(host->card); 121 ret = process_sdio_pending_irqs(host);
122 host->sdio_irq_pending = false;
120 mmc_release_host(host); 123 mmc_release_host(host);
121 124
122 /* 125 /*
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index cbde4b7e675e..0707d228d7f1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -297,6 +297,7 @@ struct mmc_host {
297 297
298 unsigned int sdio_irqs; 298 unsigned int sdio_irqs;
299 struct task_struct *sdio_irq_thread; 299 struct task_struct *sdio_irq_thread;
300 bool sdio_irq_pending;
300 atomic_t sdio_irq_thread_abort; 301 atomic_t sdio_irq_thread_abort;
301 302
302 mmc_pm_flag_t pm_flags; /* requested pm features */ 303 mmc_pm_flag_t pm_flags; /* requested pm features */
@@ -352,6 +353,7 @@ extern int mmc_cache_ctrl(struct mmc_host *, u8);
352static inline void mmc_signal_sdio_irq(struct mmc_host *host) 353static inline void mmc_signal_sdio_irq(struct mmc_host *host)
353{ 354{
354 host->ops->enable_sdio_irq(host, 0); 355 host->ops->enable_sdio_irq(host, 0);
356 host->sdio_irq_pending = true;
355 wake_up_process(host->sdio_irq_thread); 357 wake_up_process(host->sdio_irq_thread);
356} 358}
357 359