lkml.org 
[lkml]   [2024]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] mmc: core: resume not check card exist before powerup
On Wed, 27 Mar 2024 at 03:46, Ricky Wu <ricky_wu@realtek.com> wrote:
>
> _mmc_sd_resume
> add get_cd before call powerup, make sure the card exist

Please elaborate more on what problem you are trying to solve, the
above doesn't make much sense to me, sorry.

Yes, the card may be removed while the system is suspended. Then, even
if ->get_cd() indicates that there is no card inserted in the
SD-card-slot, we may still have the card being registered - and then
we need to unregister it.
That said, we need to call mmc_power_up() in order to try to
communicate with the card again. At least that is what the
mmc_rescan() work assumes when it runs the bus_ops->detect() callback
at some point later in time.

>
> Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
> ---
> drivers/mmc/core/sd.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 1c8148cdda50..35e036672cfb 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -1750,6 +1750,9 @@ static int _mmc_sd_resume(struct mmc_host *host)
> if (!mmc_card_suspended(host->card))
> goto out;
>
> + if (host->ops->get_cd && !host->ops->get_cd(host))
> + goto out;
> +
> mmc_power_up(host, host->card->ocr);
> err = mmc_sd_init_card(host, host->card->ocr, host->card);
> mmc_card_clr_suspended(host->card);
> --
> 2.25.1
>

Kind regards
Uffe

\
 
 \ /
  Last update: 2024-05-27 16:13    [W:0.241 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site