Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Nicolas Pitre and committed by
Chris Ball
bbbc4c4d 6187fee4

+10 -5
+1 -1
drivers/mmc/core/sdio.c
··· 947 947 } 948 948 949 949 if (!err && host->sdio_irqs) 950 - mmc_signal_sdio_irq(host); 950 + wake_up_process(host->sdio_irq_thread); 951 951 mmc_release_host(host); 952 952 953 953 /*
+7 -4
drivers/mmc/core/sdio_irq.c
··· 28 28 29 29 #include "sdio_ops.h" 30 30 31 - static int process_sdio_pending_irqs(struct mmc_card *card) 31 + static int process_sdio_pending_irqs(struct mmc_host *host) 32 32 { 33 + struct mmc_card *card = host->card; 33 34 int i, ret, count; 34 35 unsigned char pending; 35 36 struct sdio_func *func; 36 37 37 38 /* 38 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 43 func = card->sdio_single_irq; 42 - if (func) { 44 + if (func && host->sdio_irq_pending) { 43 45 func->irq_handler(func); 44 46 return 1; 45 47 } ··· 118 116 ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort); 119 117 if (ret) 120 118 break; 121 - ret = process_sdio_pending_irqs(host->card); 119 + ret = process_sdio_pending_irqs(host); 120 + host->sdio_irq_pending = false; 122 121 mmc_release_host(host); 123 122 124 123 /*
+2
include/linux/mmc/host.h
··· 297 297 298 298 unsigned int sdio_irqs; 299 299 struct task_struct *sdio_irq_thread; 300 + bool sdio_irq_pending; 300 301 atomic_t sdio_irq_thread_abort; 301 302 302 303 mmc_pm_flag_t pm_flags; /* requested pm features */ ··· 353 352 static inline void mmc_signal_sdio_irq(struct mmc_host *host) 354 353 { 355 354 host->ops->enable_sdio_irq(host, 0); 355 + host->sdio_irq_pending = true; 356 356 wake_up_process(host->sdio_irq_thread); 357 357 } 358 358