From: Christian Loehle <christian.loehle@arm.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org,
linux-mmc@vger.kernel.org,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Mark Brown" <broonie@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Søren Andersen" <san@skov.dk>
Subject: Re: [PATCH v2 3/6] mmc: core: refactor _mmc_suspend() for undervoltage handling
Date: Thu, 20 Feb 2025 11:05:57 +0000 [thread overview]
Message-ID: <0be29875-3254-411e-8b21-58620d68de7b@arm.com> (raw)
In-Reply-To: <20250220074429.2906141-4-o.rempel@pengutronix.de>
On 2/20/25 07:44, Oleksij Rempel wrote:
> Introduce an is_undervoltage parameter to _mmc_suspend() to apply a
> short power-off sequence and optionally flush the cache. This refactoring
> prepares for undervoltage support in a follow-up patch.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/mmc/core/mmc.c | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 6a23be214543..86b608843232 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -2104,20 +2104,27 @@ static int _mmc_flush_cache(struct mmc_host *host)
> return err;
> }
>
> -static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
> +static int _mmc_suspend(struct mmc_host *host, bool is_suspend,
> + bool is_undervoltage)
I see, sorry about missing this on 4/6 :/
> {
> + unsigned int notify_type;
> int err = 0;
> - unsigned int notify_type = is_suspend ? EXT_CSD_POWER_OFF_SHORT :
> - EXT_CSD_POWER_OFF_LONG;
> +
> + if (is_undervoltage || is_suspend)
> + notify_type = EXT_CSD_POWER_OFF_SHORT;
> + else
> + notify_type = EXT_CSD_POWER_OFF_LONG;
>
> mmc_claim_host(host);
>
> if (mmc_card_suspended(host->card))
> goto out;
>
> - err = _mmc_flush_cache(host);
> - if (err)
> - goto out;
> + if (is_undervoltage) {
> + err = _mmc_flush_cache(host);
> + if (err)
> + goto out;
> + }
This is supposed to be !is_undervoltage, isn't it?
>
> if (mmc_can_poweroff_notify(host->card) &&
> ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend ||
> @@ -2144,7 +2151,7 @@ static int mmc_suspend(struct mmc_host *host)
> {
> int err;
>
> - err = _mmc_suspend(host, true);
> + err = _mmc_suspend(host, true, false);
> if (!err) {
> pm_runtime_disable(&host->card->dev);
> pm_runtime_set_suspended(&host->card->dev);
> @@ -2191,7 +2198,7 @@ static int mmc_shutdown(struct mmc_host *host)
> err = _mmc_resume(host);
>
> if (!err)
> - err = _mmc_suspend(host, false);
> + err = _mmc_suspend(host, false, false);
>
> return err;
> }
> @@ -2215,7 +2222,7 @@ static int mmc_runtime_suspend(struct mmc_host *host)
> if (!(host->caps & MMC_CAP_AGGRESSIVE_PM))
> return 0;
>
> - err = _mmc_suspend(host, true);
> + err = _mmc_suspend(host, true, false);
> if (err)
> pr_err("%s: error %d doing aggressive suspend\n",
> mmc_hostname(host), err);
next prev parent reply other threads:[~2025-02-20 11:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 7:44 [PATCH v2 0/6] mmc: handle undervoltage events and prevent eMMC corruption Oleksij Rempel
2025-02-20 7:44 ` [PATCH v2 1/6] mmc: core: Handle undervoltage events and register regulator notifiers Oleksij Rempel
2025-02-20 7:44 ` [PATCH v2 2/6] mmc: core: make mmc_interrupt_hpi() global Oleksij Rempel
2025-02-20 7:44 ` [PATCH v2 3/6] mmc: core: refactor _mmc_suspend() for undervoltage handling Oleksij Rempel
2025-02-20 11:05 ` Christian Loehle [this message]
2025-02-20 7:44 ` [PATCH v2 4/6] mmc: core: add undervoltage handler for MMC/eMMC devices Oleksij Rempel
2025-02-20 10:47 ` Christian Loehle
2025-02-20 10:56 ` Oleksij Rempel
2025-02-20 11:22 ` Christian Loehle
2025-02-20 7:44 ` [PATCH v2 5/6] mmc: block: abort requests and suppress errors after undervoltage shutdown Oleksij Rempel
2025-02-20 7:44 ` [PATCH v2 6/6] mmc: sdhci: prevent command execution " Oleksij Rempel
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=0be29875-3254-411e-8b21-58620d68de7b@arm.com \
--to=christian.loehle@arm.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=rafael@kernel.org \
--cc=san@skov.dk \
--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