diff mbox series

[3/3] mmc: host: factor out clearing the retune state

Message ID 20210624151616.38770-4-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show
Series mmc: avoid vicious circle when retuning | expand

Commit Message

Wolfram Sang June 24, 2021, 3:16 p.m. UTC
We have this in two places, so let's have a dedicated function. It is
also more readable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/core/core.c | 3 +--
 drivers/mmc/core/host.c | 3 +--
 drivers/mmc/core/host.h | 6 ++++++
 3 files changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f397cf051b8d..469bc58c2113 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -941,8 +941,7 @@  int mmc_execute_tuning(struct mmc_card *card)
 		pr_err("%s: tuning execution failed: %d\n",
 			mmc_hostname(host), err);
 	} else {
-		host->retune_now = 0;
-		host->need_retune = 0;
+		mmc_retune_clear(host);
 		mmc_retune_enable(host);
 	}
 
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 0f084c9b2684..52d37587cf45 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -141,8 +141,7 @@  void mmc_retune_disable(struct mmc_host *host)
 	mmc_retune_unpause(host);
 	host->can_retune = 0;
 	del_timer_sync(&host->retune_timer);
-	host->retune_now = 0;
-	host->need_retune = 0;
+	mmc_retune_clear(host);
 }
 
 void mmc_retune_timer_stop(struct mmc_host *host)
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index ba407617ed23..48c4952512a5 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -21,6 +21,12 @@  int mmc_retune(struct mmc_host *host);
 void mmc_retune_pause(struct mmc_host *host);
 void mmc_retune_unpause(struct mmc_host *host);
 
+static inline void mmc_retune_clear(struct mmc_host *host)
+{
+	host->retune_now = 0;
+	host->need_retune = 0;
+}
+
 static inline void mmc_retune_hold_now(struct mmc_host *host)
 {
 	host->retune_now = 0;