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

Commit 03a13989 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: clk-scaling: fix invalid state handling during cmdq"

parents 481aa2fa 551e3e65
Loading
Loading
Loading
Loading
+29 −26
Original line number Diff line number Diff line
@@ -343,7 +343,7 @@ static int mmc_devfreq_get_dev_status(struct device *dev,
	return 0;
}

static bool mmc_is_vaild_state_for_clk_scaling(struct mmc_host *host)
static bool mmc_is_valid_state_for_clk_scaling(struct mmc_host *host)
{
	struct mmc_card *card = host->card;
	u32 status;
@@ -420,6 +420,9 @@ int mmc_clk_update_freq(struct mmc_host *host,
			host->card->clk_scaling_lowest);
	}

	if (freq == host->clk_scaling.curr_freq)
		goto out;

	if (host->ops->notify_load) {
		err = host->ops->notify_load(host, state);
		if (err) {
@@ -429,20 +432,19 @@ int mmc_clk_update_freq(struct mmc_host *host,
		}
	}

	if (freq != host->clk_scaling.curr_freq) {
	if (cmdq_mode) {
		err = mmc_cmdq_halt_on_empty_queue(host);
		if (err) {
			pr_err("%s: %s: failed halting queue (%d)\n",
				mmc_hostname(host), __func__, err);
				goto error;
			goto halt_failed;
		}
	}

		if (!mmc_is_vaild_state_for_clk_scaling(host)) {
	if (!mmc_is_valid_state_for_clk_scaling(host)) {
		pr_debug("%s: invalid state for clock scaling - skipping",
			mmc_hostname(host));
			goto error;
		goto invalid_state;
	}

	err = host->bus_ops->change_bus_speed(host, &freq);
@@ -452,13 +454,14 @@ int mmc_clk_update_freq(struct mmc_host *host,
		pr_err("%s: %s: failed (%d) at freq=%lu\n",
			mmc_hostname(host), __func__, err, freq);

invalid_state:
	if (cmdq_mode) {
		if (mmc_cmdq_halt(host, false))
			pr_err("%s: %s: cmdq unhalt failed\n",
			mmc_hostname(host), __func__);
	}
	}
error:

halt_failed:
	if (err) {
		/* restore previous state */
		if (host->ops->notify_load)