Re: [PATCH v2 2/5] mmc: core: Further avoid re-storing power to the eMMC before a shutdown

From: Ulf Hansson
Date: Tue Apr 08 2025 - 08:53:13 EST


On Tue, 8 Apr 2025 at 10:09, Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
>
>
> > @@ -2187,11 +2198,12 @@ static int mmc_shutdown(struct mmc_host *host)
> > int err = 0;
> >
> > /*
> > - * In a specific case for poweroff notify, we need to resume the card
> > - * before we can shutdown it properly.
> > + * If the card remains suspended at this point and it was done by using
> > + * the sleep-cmd (CMD5), we may need to re-initialize it first, to allow
> > + * us to send the preferred poweroff-notification cmd at shutdown.
> > */
> > if (mmc_can_poweroff_notify(host->card) &&
> > - !(host->caps2 & MMC_CAP2_FULL_PWR_CYCLE))
> > + !mmc_host_can_poweroff_notify(host, true))
>
> Ooookay, I think I got this logic now. I think it makes sense to make it
> more explicit in the comment, though:
>
> "This is then the case when the card is able to handle poweroff
> notifications in general but the host could not initiate those for
> suspend."
>
> Something like this?

Well, in my opinion I think this would become a bit too much comments
in the code.

The rather long function-names "mmc_can_poweroff_notify" (that will
change to mmc_card_can_poweroff_notify with your series) and
"mmc_host_can_poweroff_notify" are rather self-explanatory, don't you
think?

Kind regards
Uffe