mmc: host: factor out clearing the retune state
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 24 Jun 2021 15:16:16 +0000 (17:16 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 24 Aug 2021 08:15:28 +0000 (10:15 +0200)
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>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20210624151616.38770-4-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/core.c
drivers/mmc/core/host.c
drivers/mmc/core/host.h

index 95fedcf..84f39a5 100644 (file)
@@ -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);
        }
 
index 913fd62..d4683b1 100644 (file)
@@ -142,8 +142,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)
index ba40761..48c4952 100644 (file)
@@ -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;