summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2019-09-08 12:12:26 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-05 13:13:56 +0200
commit6d9a663aca54d86bf8f135224f21e2b9023a98e9 (patch)
tree8755d6b40060e4f13e68adf437fe7c17222dc1e1
parentd32263d8b9b5525df9053b1b177d7e3f2198f7ed (diff)
downloadlinux-stable-6d9a663aca54d86bf8f135224f21e2b9023a98e9.tar.gz
linux-stable-6d9a663aca54d86bf8f135224f21e2b9023a98e9.tar.bz2
linux-stable-6d9a663aca54d86bf8f135224f21e2b9023a98e9.zip
mmc: core: Add helper function to indicate if SDIO IRQs is enabled
[ Upstream commit bd880b00697befb73eff7220ee20bdae4fdd487b ] To avoid each host driver supporting SDIO IRQs, from keeping track internally about if SDIO IRQs has been claimed, let's introduce a common helper function, sdio_irq_claimed(). The function returns true if SDIO IRQs are claimed, via using the information about the number of claimed irqs. This is safe, even without any locks, as long as the helper function is called only from runtime/system suspend callbacks of the host driver. Tested-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--include/linux/mmc/host.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7ac3755444d3..56a8ad506072 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -493,6 +493,15 @@ void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq);
void mmc_cqe_request_done(struct mmc_host *host, struct mmc_request *mrq);
+/*
+ * May be called from host driver's system/runtime suspend/resume callbacks,
+ * to know if SDIO IRQs has been claimed.
+ */
+static inline bool sdio_irq_claimed(struct mmc_host *host)
+{
+ return host->sdio_irqs > 0;
+}
+
static inline void mmc_signal_sdio_irq(struct mmc_host *host)
{
host->ops->enable_sdio_irq(host, 0);