From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
linux-mmc@vger.kernel.org,
Anthony Pighin <anthony.pighin@nokia.com>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mmc: core: Further prevent card detect during shutdown
Date: Tue, 26 Nov 2024 13:57:23 +0200 [thread overview]
Message-ID: <113cb538-f337-464e-9854-3a6dcb5b95e6@intel.com> (raw)
In-Reply-To: <20241125122446.18684-1-ulf.hansson@linaro.org>
On 25/11/24 14:24, Ulf Hansson wrote:
> Disabling card detect from the host's ->shutdown_pre() callback turned out
> to not be the complete solution. More precisely, beyond the point when the
> mmc_bus->shutdown() has been called, to gracefully power off the card, we
> need to prevent card detect. Otherwise the mmc_rescan work may poll for the
> card with a CMD13, to see if it's still alive, which then will fail and
> hang as the card has already been powered off.
>
> To fix this problem, let's disable mmc_rescan prior to power off the card
> during shutdown.
>
> Reported-by: Anthony Pighin <anthony.pighin@nokia.com>
Could add a closes tag here
> Fixes: 66c915d09b94 ("mmc: core: Disable card detect during shutdown")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/core/bus.c | 2 ++
> drivers/mmc/core/core.c | 3 +++
> 2 files changed, 5 insertions(+)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index 9283b28bc69f..1cf64e0952fb 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -149,6 +149,8 @@ static void mmc_bus_shutdown(struct device *dev)
> if (dev->driver && drv->shutdown)
> drv->shutdown(card);
>
> + __mmc_stop_host(host);
> +
> if (host->bus_ops->shutdown) {
> ret = host->bus_ops->shutdown(host);
> if (ret)
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index a499f3c59de5..d996d39c0d6f 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2335,6 +2335,9 @@ void mmc_start_host(struct mmc_host *host)
>
> void __mmc_stop_host(struct mmc_host *host)
> {
> + if (host->rescan_disable)
> + return;
> +
> if (host->slot.cd_irq >= 0) {
> mmc_gpio_set_cd_wake(host, false);
> disable_irq(host->slot.cd_irq);
next prev parent reply other threads:[~2024-11-26 11:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 12:24 Ulf Hansson
2024-11-26 11:57 ` Adrian Hunter [this message]
2024-11-26 12:17 ` Ulf Hansson
2024-12-02 15:23 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=113cb538-f337-464e-9854-3a6dcb5b95e6@intel.com \
--to=adrian.hunter@intel.com \
--cc=anthony.pighin@nokia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®