diff mbox series

[RFC] mmc: only print retune error when we don't check for card removal

Message ID 20210630041658.7574-1-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show
Series [RFC] mmc: only print retune error when we don't check for card removal | expand

Commit Message

Wolfram Sang June 30, 2021, 4:16 a.m. UTC
Skip printing a retune error when we scan for a removed card because we
then expect a failed command.

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

In my tests, detect_change was only set when a card was removed.
Inserting a card or resuming from RPM would print an error. Did I
overlook somethign or is this good to go?

 drivers/mmc/core/core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Wolfram Sang July 30, 2021, 2:02 p.m. UTC | #1
On Wed, Jun 30, 2021 at 06:16:58AM +0200, Wolfram Sang wrote:
> Skip printing a retune error when we scan for a removed card because we
> then expect a failed command.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> In my tests, detect_change was only set when a card was removed.
> Inserting a card or resuming from RPM would print an error. Did I
> overlook somethign or is this good to go?

So, what about this to remove the bogus 'retune failure' command?
I also think the code is a tad more readable this way.

> 
>  drivers/mmc/core/core.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index b039dcff17f8..b7e6e5640640 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -937,11 +937,13 @@ int mmc_execute_tuning(struct mmc_card *card)
>  
>  	err = host->ops->execute_tuning(host, opcode);
>  
> -	if (err)
> +	if (!err)
> +		mmc_retune_enable(host);
> +
> +	/* Only print error when we don't check for card removal */
> +	if (err && !host->detect_change)
>  		pr_err("%s: tuning execution failed: %d\n",
>  			mmc_hostname(host), err);
> -	else
> -		mmc_retune_enable(host);
>  
>  	return err;
>  }
> -- 
> 2.30.2
>
Adrian Hunter Aug. 4, 2021, 7:11 a.m. UTC | #2
On 30/06/21 7:16 am, Wolfram Sang wrote:
> Skip printing a retune error when we scan for a removed card because we
> then expect a failed command.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Seems OK to me, but needs re-base. Nevertheless:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> In my tests, detect_change was only set when a card was removed.
> Inserting a card or resuming from RPM would print an error. Did I
> overlook somethign or is this good to go?
> 
>  drivers/mmc/core/core.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index b039dcff17f8..b7e6e5640640 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -937,11 +937,13 @@ int mmc_execute_tuning(struct mmc_card *card)
>  
>  	err = host->ops->execute_tuning(host, opcode);
>  
> -	if (err)
> +	if (!err)
> +		mmc_retune_enable(host);
> +
> +	/* Only print error when we don't check for card removal */
> +	if (err && !host->detect_change)
>  		pr_err("%s: tuning execution failed: %d\n",
>  			mmc_hostname(host), err);
> -	else
> -		mmc_retune_enable(host);
>  
>  	return err;
>  }
>
Ulf Hansson Aug. 6, 2021, 1:07 p.m. UTC | #3
On Wed, 4 Aug 2021 at 09:10, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 30/06/21 7:16 am, Wolfram Sang wrote:
> > Skip printing a retune error when we scan for a removed card because we
> > then expect a failed command.
> >
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> Seems OK to me, but needs re-base. Nevertheless:
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

I did the rebase myself and applied it for next, thanks to both of you!

Kind regards
Uffe


>
> > ---
> >
> > In my tests, detect_change was only set when a card was removed.
> > Inserting a card or resuming from RPM would print an error. Did I
> > overlook somethign or is this good to go?
> >
> >  drivers/mmc/core/core.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> > index b039dcff17f8..b7e6e5640640 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -937,11 +937,13 @@ int mmc_execute_tuning(struct mmc_card *card)
> >
> >       err = host->ops->execute_tuning(host, opcode);
> >
> > -     if (err)
> > +     if (!err)
> > +             mmc_retune_enable(host);
> > +
> > +     /* Only print error when we don't check for card removal */
> > +     if (err && !host->detect_change)
> >               pr_err("%s: tuning execution failed: %d\n",
> >                       mmc_hostname(host), err);
> > -     else
> > -             mmc_retune_enable(host);
> >
> >       return err;
> >  }
> >
>
diff mbox series

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index b039dcff17f8..b7e6e5640640 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -937,11 +937,13 @@  int mmc_execute_tuning(struct mmc_card *card)
 
 	err = host->ops->execute_tuning(host, opcode);
 
-	if (err)
+	if (!err)
+		mmc_retune_enable(host);
+
+	/* Only print error when we don't check for card removal */
+	if (err && !host->detect_change)
 		pr_err("%s: tuning execution failed: %d\n",
 			mmc_hostname(host), err);
-	else
-		mmc_retune_enable(host);
 
 	return err;
 }