Loading drivers/mmc/host/sdhci.c +14 −11 Original line number Diff line number Diff line Loading @@ -2515,26 +2515,29 @@ EXPORT_SYMBOL_GPL(sdhci_get_cd_nogpio); static int sdhci_check_ro(struct sdhci_host *host) { unsigned long flags; bool allow_invert = false; int is_readonly; spin_lock_irqsave(&host->lock, flags); if (host->flags & SDHCI_DEVICE_DEAD) if (host->flags & SDHCI_DEVICE_DEAD) { is_readonly = 0; else if (host->ops->get_ro) } else if (host->ops->get_ro) { is_readonly = host->ops->get_ro(host); else if (mmc_can_gpio_ro(host->mmc)) } else if (mmc_can_gpio_ro(host->mmc)) { is_readonly = mmc_gpio_get_ro(host->mmc); else /* Do not invert twice */ allow_invert = !(host->mmc->caps2 & MMC_CAP2_RO_ACTIVE_HIGH); } else { is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_WRITE_PROTECT); allow_invert = true; } spin_unlock_irqrestore(&host->lock, flags); if (is_readonly >= 0 && allow_invert && (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT)) is_readonly = !is_readonly; /* This quirk needs to be replaced by a callback-function later */ return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ? !is_readonly : is_readonly; return is_readonly; } #define SAMPLE_COUNT 5 Loading Loading
drivers/mmc/host/sdhci.c +14 −11 Original line number Diff line number Diff line Loading @@ -2515,26 +2515,29 @@ EXPORT_SYMBOL_GPL(sdhci_get_cd_nogpio); static int sdhci_check_ro(struct sdhci_host *host) { unsigned long flags; bool allow_invert = false; int is_readonly; spin_lock_irqsave(&host->lock, flags); if (host->flags & SDHCI_DEVICE_DEAD) if (host->flags & SDHCI_DEVICE_DEAD) { is_readonly = 0; else if (host->ops->get_ro) } else if (host->ops->get_ro) { is_readonly = host->ops->get_ro(host); else if (mmc_can_gpio_ro(host->mmc)) } else if (mmc_can_gpio_ro(host->mmc)) { is_readonly = mmc_gpio_get_ro(host->mmc); else /* Do not invert twice */ allow_invert = !(host->mmc->caps2 & MMC_CAP2_RO_ACTIVE_HIGH); } else { is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_WRITE_PROTECT); allow_invert = true; } spin_unlock_irqrestore(&host->lock, flags); if (is_readonly >= 0 && allow_invert && (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT)) is_readonly = !is_readonly; /* This quirk needs to be replaced by a callback-function later */ return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ? !is_readonly : is_readonly; return is_readonly; } #define SAMPLE_COUNT 5 Loading