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

Commit 36371a16 authored by Veerabhadrarao Badiganti's avatar Veerabhadrarao Badiganti
Browse files

mmc: core: Increase the runtime PM reference count in try_claim_host



Runtime PM reference count is being increased in mmc_claim_host() and
is decreased in mmc_release_host(). This reference count is kept
during the complete cycle of a claim -> release host.

Same need to be done even in mmc_try_claim_host() as well. Increase
the runtime PM reference count by invoking pm_runtime_get_sync() from
mmc_try_claim_host() upon first successful claim.

Without this change the runtime PM reference count goes for a toss
since count is not getting incremented in mmc_try_claim_host() but is
getting decremented in mmc_release_host().

Change-Id: I77836875b4700a4bf3dbde2bf1abdf2ad36c4cac
Signed-off-by: default avatarVeerabhadrarao Badiganti <vbadigan@codeaurora.org>
parent 11f73a0c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2252,6 +2252,7 @@ int mmc_try_claim_host(struct mmc_host *host, unsigned int delay_ms)
	int claimed_host = 0;
	unsigned long flags;
	int retry_cnt = delay_ms/10;
	bool pm = false;

	do {
		spin_lock_irqsave(&host->lock, flags);
@@ -2260,11 +2261,17 @@ int mmc_try_claim_host(struct mmc_host *host, unsigned int delay_ms)
			host->claimer = current;
			host->claim_cnt += 1;
			claimed_host = 1;
			if (host->claim_cnt == 1)
				pm = true;
		}
		spin_unlock_irqrestore(&host->lock, flags);
		if (!claimed_host)
			mmc_delay(10);
	} while (!claimed_host && retry_cnt--);

	if (pm)
		pm_runtime_get_sync(mmc_dev(host));

	if (host->ops->enable && claimed_host && host->claim_cnt == 1)
		host->ops->enable(host);
	return claimed_host;