Only try managing the regulator when EXT_RESOURCES is defined

Not all Raspberry Pi kernel configs define EXT_RESOURCES. Check for this
before trying to manage the regulator.

Sponsored by:	Innovate UK
This commit is contained in:
Andrew Turner 2020-07-29 08:24:40 +00:00
parent 055f269472
commit 65e305af3d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363660

View File

@ -394,10 +394,13 @@ bcm_sdhci_intr(void *arg)
static int static int
bcm_sdhci_update_ios(device_t bus, device_t child) bcm_sdhci_update_ios(device_t bus, device_t child)
{ {
#ifdef EXT_RESOURCES
struct bcm_sdhci_softc *sc; struct bcm_sdhci_softc *sc;
struct mmc_ios *ios; struct mmc_ios *ios;
#endif
int rv; int rv;
#ifdef EXT_RESOURCES
sc = device_get_softc(bus); sc = device_get_softc(bus);
ios = &sc->sc_slot.host.ios; ios = &sc->sc_slot.host.ios;
@ -407,17 +410,20 @@ bcm_sdhci_update_ios(device_t bus, device_t child)
if (sc->sc_mmc_helper.vqmmc_supply) if (sc->sc_mmc_helper.vqmmc_supply)
regulator_enable(sc->sc_mmc_helper.vqmmc_supply); regulator_enable(sc->sc_mmc_helper.vqmmc_supply);
} }
#endif
rv = sdhci_generic_update_ios(bus, child); rv = sdhci_generic_update_ios(bus, child);
if (rv != 0) if (rv != 0)
return (rv); return (rv);
#ifdef EXT_RESOURCES
if (ios->power_mode == power_off) { if (ios->power_mode == power_off) {
if (sc->sc_mmc_helper.vmmc_supply) if (sc->sc_mmc_helper.vmmc_supply)
regulator_disable(sc->sc_mmc_helper.vmmc_supply); regulator_disable(sc->sc_mmc_helper.vmmc_supply);
if (sc->sc_mmc_helper.vqmmc_supply) if (sc->sc_mmc_helper.vqmmc_supply)
regulator_disable(sc->sc_mmc_helper.vqmmc_supply); regulator_disable(sc->sc_mmc_helper.vqmmc_supply);
} }
#endif
return (0); return (0);
} }