diff mbox series

[RFC] mmc: core: ensure flags are always cleared when retune gets enabled

Message ID 20210625190107.8160-1-wsa+renesas@sang-engineering.com
State New
Headers show
Series [RFC] mmc: core: ensure flags are always cleared when retune gets enabled | expand

Commit Message

Wolfram Sang June 25, 2021, 7:01 p.m. UTC
Move the call to clear the retune flags into mmc_retune_enable() to
ensure they are always cleared. With current code, there is no
functional change. But it is more future-proof this way.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

After reviewing my own code, I thought this is even a tad better. What
do you guys think? Based on the series "[PATCH 0/3] mmc: avoid vicious
circle when retuning", of course.

 drivers/mmc/core/core.c | 6 ++----
 drivers/mmc/core/host.c | 1 +
 2 files changed, 3 insertions(+), 4 deletions(-)

Comments

Wolfram Sang July 30, 2021, 2 p.m. UTC | #1
On Fri, Jun 25, 2021 at 09:01:07PM +0200, Wolfram Sang wrote:
> Move the call to clear the retune flags into mmc_retune_enable() to

> ensure they are always cleared. With current code, there is no

> functional change. But it is more future-proof this way.

> 

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> ---

> 

> After reviewing my own code, I thought this is even a tad better. What

> do you guys think? Based on the series "[PATCH 0/3] mmc: avoid vicious

> circle when retuning", of course.


Would be easy to apply now because the dependency is in mmc/next now.
Opinions?

> 

>  drivers/mmc/core/core.c | 6 ++----

>  drivers/mmc/core/host.c | 1 +

>  2 files changed, 3 insertions(+), 4 deletions(-)

> 

> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c

> index 84f39a59a28e..b039dcff17f8 100644

> --- a/drivers/mmc/core/core.c

> +++ b/drivers/mmc/core/core.c

> @@ -937,13 +937,11 @@ int mmc_execute_tuning(struct mmc_card *card)

>  

>  	err = host->ops->execute_tuning(host, opcode);

>  

> -	if (err) {

> +	if (err)

>  		pr_err("%s: tuning execution failed: %d\n",

>  			mmc_hostname(host), err);

> -	} else {

> -		mmc_retune_clear(host);

> +	else

>  		mmc_retune_enable(host);

> -	}

>  

>  	return err;

>  }

> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c

> index 52d37587cf45..8ca1db6413f8 100644

> --- a/drivers/mmc/core/host.c

> +++ b/drivers/mmc/core/host.c

> @@ -101,6 +101,7 @@ void mmc_unregister_host_class(void)

>   */

>  void mmc_retune_enable(struct mmc_host *host)

>  {

> +	mmc_retune_clear(host);

>  	host->can_retune = 1;

>  	if (host->retune_period)

>  		mod_timer(&host->retune_timer,

> -- 

> 2.30.2

>
Adrian Hunter Aug. 4, 2021, 7:06 a.m. UTC | #2
On 25/06/21 10:01 pm, Wolfram Sang wrote:
> Move the call to clear the retune flags into mmc_retune_enable() to

> ensure they are always cleared. With current code, there is no

> functional change. But it is more future-proof this way.


To me they seem conceptually separate functions.

> 

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> ---

> 

> After reviewing my own code, I thought this is even a tad better. What

> do you guys think? Based on the series "[PATCH 0/3] mmc: avoid vicious

> circle when retuning", of course.

> 

>  drivers/mmc/core/core.c | 6 ++----

>  drivers/mmc/core/host.c | 1 +

>  2 files changed, 3 insertions(+), 4 deletions(-)

> 

> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c

> index 84f39a59a28e..b039dcff17f8 100644

> --- a/drivers/mmc/core/core.c

> +++ b/drivers/mmc/core/core.c

> @@ -937,13 +937,11 @@ int mmc_execute_tuning(struct mmc_card *card)

>  

>  	err = host->ops->execute_tuning(host, opcode);

>  

> -	if (err) {

> +	if (err)

>  		pr_err("%s: tuning execution failed: %d\n",

>  			mmc_hostname(host), err);

> -	} else {

> -		mmc_retune_clear(host);

> +	else

>  		mmc_retune_enable(host);

> -	}

>  

>  	return err;

>  }

> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c

> index 52d37587cf45..8ca1db6413f8 100644

> --- a/drivers/mmc/core/host.c

> +++ b/drivers/mmc/core/host.c

> @@ -101,6 +101,7 @@ void mmc_unregister_host_class(void)

>   */

>  void mmc_retune_enable(struct mmc_host *host)

>  {

> +	mmc_retune_clear(host);

>  	host->can_retune = 1;

>  	if (host->retune_period)

>  		mod_timer(&host->retune_timer,

>
diff mbox series

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 84f39a59a28e..b039dcff17f8 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -937,13 +937,11 @@  int mmc_execute_tuning(struct mmc_card *card)
 
 	err = host->ops->execute_tuning(host, opcode);
 
-	if (err) {
+	if (err)
 		pr_err("%s: tuning execution failed: %d\n",
 			mmc_hostname(host), err);
-	} else {
-		mmc_retune_clear(host);
+	else
 		mmc_retune_enable(host);
-	}
 
 	return err;
 }
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 52d37587cf45..8ca1db6413f8 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -101,6 +101,7 @@  void mmc_unregister_host_class(void)
  */
 void mmc_retune_enable(struct mmc_host *host)
 {
+	mmc_retune_clear(host);
 	host->can_retune = 1;
 	if (host->retune_period)
 		mod_timer(&host->retune_timer,