diff mbox series

[1/2] mmc: core: Drop check for mmc_card_is_removable() in mmc_rescan()

Message ID 20191017135739.1315-2-ulf.hansson@linaro.org (mailing list archive)
State Not Applicable
Delegated to: Johannes Berg
Headers show
Series mmc: core: Fixup HW reset for SDIO cards | expand

Commit Message

Ulf Hansson Oct. 17, 2019, 1:57 p.m. UTC
Upfront in mmc_rescan() we use the host->rescan_entered flag, to allow
scanning only once for non-removable cards. Therefore, it's also not
possible that we can have bus attached, when we are scanning non-removable
cards. For this reason, let' drop the check for mmc_card_is_removable() as
it's redundant.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Doug Anderson Oct. 21, 2019, 10:13 p.m. UTC | #1
Hi,

On Thu, Oct 17, 2019 at 6:57 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> Upfront in mmc_rescan() we use the host->rescan_entered flag, to allow
> scanning only once for non-removable cards. Therefore, it's also not
> possible that we can have bus attached, when we are scanning non-removable
> cards. For this reason, let' drop the check for mmc_card_is_removable() as
> it's redundant.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  drivers/mmc/core/core.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 221127324709..6f8342702c73 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2297,11 +2297,8 @@ void mmc_rescan(struct work_struct *work)
>
>         mmc_bus_get(host);
>
> -       /*
> -        * if there is a _removable_ card registered, check whether it is
> -        * still present
> -        */
> -       if (host->bus_ops && !host->bus_dead && mmc_card_is_removable(host))
> +       /* Verify a registered card to be functional, else remove it. */
> +       if (host->bus_ops && !host->bus_dead)
>                 host->bus_ops->detect(host);

At first I thought this was a bit more of a change than your
description makes it sound like.  Specifically it seemed like
non-removable cards used to never call host->bus_ops->detect() here
(even during the first call to mmc_rescan) but now they would call it
the first time through.

...so I put in a bunch of printouts.  It appears that the first time
through mmc_rescan() host->bus_ops is NULL.

...ah, and this is what that sentence in your description means about
having a bus attached.  Now I get it!  :-)

...so, right, this looks fine.

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Ulf Hansson Oct. 22, 2019, 6:19 a.m. UTC | #2
On Tue, 22 Oct 2019 at 00:13, Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Thu, Oct 17, 2019 at 6:57 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >
> > Upfront in mmc_rescan() we use the host->rescan_entered flag, to allow
> > scanning only once for non-removable cards. Therefore, it's also not
> > possible that we can have bus attached, when we are scanning non-removable
> > cards. For this reason, let' drop the check for mmc_card_is_removable() as
> > it's redundant.
> >
> > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> > ---
> >  drivers/mmc/core/core.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> > index 221127324709..6f8342702c73 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -2297,11 +2297,8 @@ void mmc_rescan(struct work_struct *work)
> >
> >         mmc_bus_get(host);
> >
> > -       /*
> > -        * if there is a _removable_ card registered, check whether it is
> > -        * still present
> > -        */
> > -       if (host->bus_ops && !host->bus_dead && mmc_card_is_removable(host))
> > +       /* Verify a registered card to be functional, else remove it. */
> > +       if (host->bus_ops && !host->bus_dead)
> >                 host->bus_ops->detect(host);
>
> At first I thought this was a bit more of a change than your
> description makes it sound like.  Specifically it seemed like
> non-removable cards used to never call host->bus_ops->detect() here
> (even during the first call to mmc_rescan) but now they would call it
> the first time through.
>
> ...so I put in a bunch of printouts.  It appears that the first time
> through mmc_rescan() host->bus_ops is NULL.
>
> ...ah, and this is what that sentence in your description means about
> having a bus attached.  Now I get it!  :-)
>
> ...so, right, this looks fine.
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>

Thanks for testing and reviewing! Let me amend the changelog a bit, to
try to clarify that the host->bus_ops is NULL.

Additionally, I think this one should be tagged for stable, but let's
see what happens with patch 2/2 first.

Kind regards
Uffe
diff mbox series

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 221127324709..6f8342702c73 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2297,11 +2297,8 @@  void mmc_rescan(struct work_struct *work)
 
 	mmc_bus_get(host);
 
-	/*
-	 * if there is a _removable_ card registered, check whether it is
-	 * still present
-	 */
-	if (host->bus_ops && !host->bus_dead && mmc_card_is_removable(host))
+	/* Verify a registered card to be functional, else remove it. */
+	if (host->bus_ops && !host->bus_dead)
 		host->bus_ops->detect(host);
 
 	host->detect_change = 0;