Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f743d03 authored by David E. Box's avatar David E. Box Committed by Ulf Hansson
Browse files

mmc: sdhci-pci: Allow deferred probe for sd card detect gpio



With commit f35bbf61 ("gpio / ACPI: Return -EPROBE_DEFER if the
gpiochip was not found"), a gpio descriptor request can now be deferred if
the providing gpio host controller driver hasn't been loaded yet. Allow use
in mmc slot probe in order to prevent card detect gpio setup from failing
in this case.

Signed-off-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 2d1956d0
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -1760,12 +1760,17 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
	host->mmc->slotno = slotno;
	host->mmc->caps2 |= MMC_CAP2_NO_PRESCAN_POWERUP;

	if (slot->cd_idx >= 0 &&
	    mmc_gpiod_request_cd(host->mmc, slot->cd_con_id, slot->cd_idx,
				 slot->cd_override_level, 0, NULL)) {
	if (slot->cd_idx >= 0) {
		ret = mmc_gpiod_request_cd(host->mmc, slot->cd_con_id, slot->cd_idx,
					   slot->cd_override_level, 0, NULL);
		if (ret == -EPROBE_DEFER)
			goto remove;

		if (ret) {
			dev_warn(&pdev->dev, "failed to setup card detect gpio\n");
			slot->cd_idx = -1;
		}
	}

	ret = sdhci_add_host(host);
	if (ret)