Skip to content

Commit ab069ce

Browse files
ahunter6storulf
authored andcommitted
mmc: sdhci: Do not lock spinlock around mmc_gpio_get_ro()
sdhci_check_ro() can call mmc_gpio_get_ro() while holding the sdhci host->lock spinlock. That would be a problem if the GPIO access done by mmc_gpio_get_ro() needed to sleep. However, host->lock is not needed anyway. The mmc core ensures that host operations do not race with each other, and asynchronous callbacks like the interrupt handler, software timeouts, completion work etc, cannot affect sdhci_check_ro(). So remove the locking. Fixes: 6d5cd06 ("mmc: sdhci: use WP GPIO in sdhci_check_ro()") Signed-off-by: Adrian Hunter <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent fbd64f9 commit ab069ce

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,11 +2516,8 @@ EXPORT_SYMBOL_GPL(sdhci_get_cd_nogpio);
25162516
static int sdhci_check_ro(struct sdhci_host *host)
25172517
{
25182518
bool allow_invert = false;
2519-
unsigned long flags;
25202519
int is_readonly;
25212520

2522-
spin_lock_irqsave(&host->lock, flags);
2523-
25242521
if (host->flags & SDHCI_DEVICE_DEAD) {
25252522
is_readonly = 0;
25262523
} else if (host->ops->get_ro) {
@@ -2535,8 +2532,6 @@ static int sdhci_check_ro(struct sdhci_host *host)
25352532
allow_invert = true;
25362533
}
25372534

2538-
spin_unlock_irqrestore(&host->lock, flags);
2539-
25402535
if (is_readonly >= 0 &&
25412536
allow_invert &&
25422537
(host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT))

0 commit comments

Comments
 (0)