]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
mmc: sdio: avoid spurious calls to interrupt handlers
authorNicolas Pitre <nicolas.pitre@linaro.org>
Mon, 16 Apr 2012 23:16:54 +0000 (19:16 -0400)
committerChris Ball <cjb@laptop.org>
Sun, 22 Apr 2012 15:17:28 +0000 (11:17 -0400)
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>
drivers/mmc/core/sdio.c
drivers/mmc/core/sdio_irq.c
include/linux/mmc/host.h

index 2c7c83f832d289c25eaf83cf4d7ef32d420fb002..13d0e95380ab8f73d601060c3415b82bb253d12b 100644 (file)
@@ -947,7 +947,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
        }
 
        if (!err && host->sdio_irqs)
-               mmc_signal_sdio_irq(host);
+               wake_up_process(host->sdio_irq_thread);
        mmc_release_host(host);
 
        /*
index f573e7f9f74020dae69aa3ba861bbcadf66ffc4e..3d8ceb4084debf900693f07f1bb7a5d8588cdfab 100644 (file)
 
 #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;
        unsigned char pending;
        struct sdio_func *func;
 
        /*
         * 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;
-       if (func) {
+       if (func && host->sdio_irq_pending) {
                func->irq_handler(func);
                return 1;
        }
@@ -116,7 +118,8 @@ static int sdio_irq_thread(void *_host)
                ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort);
                if (ret)
                        break;
-               ret = process_sdio_pending_irqs(host->card);
+               ret = process_sdio_pending_irqs(host);
+               host->sdio_irq_pending = false;
                mmc_release_host(host);
 
                /*
index cbde4b7e675ed28eda507784c185d6ebc6b30215..0707d228d7f11d675743aa8d58b5b5c05274295f 100644 (file)
@@ -297,6 +297,7 @@ struct mmc_host {
 
        unsigned int            sdio_irqs;
        struct task_struct      *sdio_irq_thread;
+       bool                    sdio_irq_pending;
        atomic_t                sdio_irq_thread_abort;
 
        mmc_pm_flag_t           pm_flags;       /* requested pm features */
@@ -352,6 +353,7 @@ extern int mmc_cache_ctrl(struct mmc_host *, u8);
 static inline void mmc_signal_sdio_irq(struct mmc_host *host)
 {
        host->ops->enable_sdio_irq(host, 0);
+       host->sdio_irq_pending = true;
        wake_up_process(host->sdio_irq_thread);
 }