linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] mmc: core: ensure flags are always cleared when retune gets enabled
@ 2021-06-25 19:01 Wolfram Sang
  2021-07-30 14:00 ` Wolfram Sang
  2021-08-04  7:06 ` Adrian Hunter
  0 siblings, 2 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-06-25 19:01 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Yoshihiro Shimoda, Adrian Hunter, Wolfram Sang

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(-)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] mmc: core: ensure flags are always cleared when retune gets enabled
  2021-06-25 19:01 [RFC PATCH] mmc: core: ensure flags are always cleared when retune gets enabled Wolfram Sang
@ 2021-07-30 14:00 ` Wolfram Sang
  2021-08-04  7:06 ` Adrian Hunter
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-07-30 14:00 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Adrian Hunter

[-- Attachment #1: Type: text/plain, Size: 1730 bytes --]

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
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] mmc: core: ensure flags are always cleared when retune gets enabled
  2021-06-25 19:01 [RFC PATCH] mmc: core: ensure flags are always cleared when retune gets enabled Wolfram Sang
  2021-07-30 14:00 ` Wolfram Sang
@ 2021-08-04  7:06 ` Adrian Hunter
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2021-08-04  7:06 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda

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,
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-04  7:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 19:01 [RFC PATCH] mmc: core: ensure flags are always cleared when retune gets enabled Wolfram Sang
2021-07-30 14:00 ` Wolfram Sang
2021-08-04  7:06 ` Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).