Skip to content

Commit ef10433

Browse files
Russell Kingcjb
authored andcommitted
mmc: sdhci: clean up sdio interrupt enable handling
We don't need to change the SDHCI_SDIO_IRQ_ENABLED flag when we're merely receiving an interrupt - IRQ handling thread in the MMC core will either re-enable or disable the interrupt via the enable_sdio_irq callback, which will update this status appropriately. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-by: Markus Pargmann <mpa@pengutronix.de> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
1 parent 4100500 commit ef10433

1 file changed

Lines changed: 17 additions & 18 deletions

File tree

‎drivers/mmc/host/sdhci.c‎

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,34 +1711,33 @@ static int sdhci_get_ro(struct mmc_host *mmc)
17111711

17121712
static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable)
17131713
{
1714-
if (host->flags & SDHCI_DEVICE_DEAD)
1715-
goto out;
1716-
1717-
if (enable)
1718-
host->flags |= SDHCI_SDIO_IRQ_ENABLED;
1719-
else
1720-
host->flags &= ~SDHCI_SDIO_IRQ_ENABLED;
1721-
17221714
/* SDIO IRQ will be enabled as appropriate in runtime resume */
1723-
if (host->runtime_suspended)
1724-
goto out;
1725-
1726-
if (enable)
1727-
sdhci_unmask_irqs(host, SDHCI_INT_CARD_INT);
1728-
else
1729-
sdhci_mask_irqs(host, SDHCI_INT_CARD_INT);
1730-
out:
1731-
mmiowb();
1715+
if (!(host->flags & SDHCI_DEVICE_DEAD) || host->runtime_suspended) {
1716+
if (enable)
1717+
sdhci_unmask_irqs(host, SDHCI_INT_CARD_INT);
1718+
else
1719+
sdhci_mask_irqs(host, SDHCI_INT_CARD_INT);
1720+
mmiowb();
1721+
}
17321722
}
17331723

17341724
static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
17351725
{
17361726
struct sdhci_host *host = mmc_priv(mmc);
17371727
unsigned long flags;
17381728

1729+
sdhci_runtime_pm_get(host);
1730+
17391731
spin_lock_irqsave(&host->lock, flags);
1732+
if (enable)
1733+
host->flags |= SDHCI_SDIO_IRQ_ENABLED;
1734+
else
1735+
host->flags &= ~SDHCI_SDIO_IRQ_ENABLED;
1736+
17401737
sdhci_enable_sdio_irq_nolock(host, enable);
17411738
spin_unlock_irqrestore(&host->lock, flags);
1739+
1740+
sdhci_runtime_pm_put(host);
17421741
}
17431742

17441743
static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
@@ -2726,7 +2725,7 @@ int sdhci_runtime_resume_host(struct sdhci_host *host)
27262725
host->runtime_suspended = false;
27272726

27282727
/* Enable SDIO IRQ */
2729-
if ((host->flags & SDHCI_SDIO_IRQ_ENABLED))
2728+
if (host->flags & SDHCI_SDIO_IRQ_ENABLED)
27302729
sdhci_enable_sdio_irq_nolock(host, true);
27312730

27322731
/* Enable Card Detection */

0 commit comments

Comments
 (0)