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

Commit a5e9425d authored by Ohad Ben-Cohen's avatar Ohad Ben-Cohen Committed by Chris Ball
Browse files

mmc: mmc_card_keep_power cleanups



mmc_card_is_powered_resumed is a mouthful; instead, simply use
mmc_card_keep_power, which also better explains the purpose of
the macro.

Employ mmc_card_keep_power() where possible.

Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent f4c5522b
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1746,7 +1746,7 @@ int mmc_suspend_host(struct mmc_host *host)
	}
	}
	mmc_bus_put(host);
	mmc_bus_put(host);


	if (!err && !(host->pm_flags & MMC_PM_KEEP_POWER))
	if (!err && !mmc_card_keep_power(host))
		mmc_power_off(host);
		mmc_power_off(host);


	return err;
	return err;
@@ -1764,7 +1764,7 @@ int mmc_resume_host(struct mmc_host *host)


	mmc_bus_get(host);
	mmc_bus_get(host);
	if (host->bus_ops && !host->bus_dead) {
	if (host->bus_ops && !host->bus_dead) {
		if (!(host->pm_flags & MMC_PM_KEEP_POWER)) {
		if (!mmc_card_keep_power(host)) {
			mmc_power_up(host);
			mmc_power_up(host);
			mmc_select_voltage(host, host->ocr);
			mmc_select_voltage(host, host->ocr);
			/*
			/*
+5 −5
Original line number Original line Diff line number Diff line
@@ -625,7 +625,7 @@ static int mmc_sdio_suspend(struct mmc_host *host)
		}
		}
	}
	}


	if (!err && host->pm_flags & MMC_PM_KEEP_POWER) {
	if (!err && mmc_card_keep_power(host)) {
		mmc_claim_host(host);
		mmc_claim_host(host);
		sdio_disable_wide(host->card);
		sdio_disable_wide(host->card);
		mmc_release_host(host);
		mmc_release_host(host);
@@ -645,10 +645,10 @@ static int mmc_sdio_resume(struct mmc_host *host)
	mmc_claim_host(host);
	mmc_claim_host(host);


	/* No need to reinitialize powered-resumed nonremovable cards */
	/* No need to reinitialize powered-resumed nonremovable cards */
	if (mmc_card_is_removable(host) || !mmc_card_is_powered_resumed(host))
	if (mmc_card_is_removable(host) || !mmc_card_keep_power(host))
		err = mmc_sdio_init_card(host, host->ocr, host->card,
		err = mmc_sdio_init_card(host, host->ocr, host->card,
				 (host->pm_flags & MMC_PM_KEEP_POWER));
					mmc_card_keep_power(host));
	else if (mmc_card_is_powered_resumed(host)) {
	else if (mmc_card_keep_power(host)) {
		/* We may have switched to 1-bit mode during suspend */
		/* We may have switched to 1-bit mode during suspend */
		err = sdio_enable_4bit_bus(host->card);
		err = sdio_enable_4bit_bus(host->card);
		if (err > 0) {
		if (err > 0) {
@@ -691,7 +691,7 @@ static int mmc_sdio_power_restore(struct mmc_host *host)


	mmc_claim_host(host);
	mmc_claim_host(host);
	ret = mmc_sdio_init_card(host, host->ocr, host->card,
	ret = mmc_sdio_init_card(host, host->ocr, host->card,
			(host->pm_flags & MMC_PM_KEEP_POWER));
				mmc_card_keep_power(host));
	if (!ret && host->sdio_irqs)
	if (!ret && host->sdio_irqs)
		mmc_signal_sdio_irq(host);
		mmc_signal_sdio_irq(host);
	mmc_release_host(host);
	mmc_release_host(host);
+1 −1
Original line number Original line Diff line number Diff line
@@ -320,7 +320,7 @@ static inline int mmc_card_is_removable(struct mmc_host *host)
	return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable;
	return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable;
}
}


static inline int mmc_card_is_powered_resumed(struct mmc_host *host)
static inline int mmc_card_keep_power(struct mmc_host *host)
{
{
	return host->pm_flags & MMC_PM_KEEP_POWER;
	return host->pm_flags & MMC_PM_KEEP_POWER;
}
}