On 13/02/2024 09:49, 이승희 wrote: > > >> -----Original Message----- >> From: Avri Altman <Avri.Altman@xxxxxxx> >> Sent: Tuesday, February 13, 2024 5:42 PM >> To: Seunghui Lee <sh043.lee@xxxxxxxxxxx>; linux-mmc@xxxxxxxxxxxxxxx; >> linux-kernel@xxxxxxxxxxxxxxx; ulf.hansson@xxxxxxxxxx; >> gregkh@xxxxxxxxxxxxxxxxxxx >> Cc: grant.jung@xxxxxxxxxxx; jt77.jang@xxxxxxxxxxx; >> dh0421.hwang@xxxxxxxxxxx; junwoo80.lee@xxxxxxxxxxx; jangsub.yi@xxxxxxxxxxx; >> cw9316.lee@xxxxxxxxxxx; sh8267.baek@xxxxxxxxxxx; wkon.kim@xxxxxxxxxxx >> Subject: RE: [PATCH] mmc: sd: Add a variable to check a faulty device >> >>> In mobile devices, suspend/resume situations are frequent. >>> In the case of a defective SD card in which initialization fails, >>> unnecessary initialization time is consumed for each resume. >>> A field is needed to check that SD card initialization has failed on >>> the host. It could be used to remove unnecessary initialization. >> I don't see where you are using this new init_failed field? >> Maybe instead, elaborate the logic to free_card: to detect a broken sd. >> e.g. instead of just if (!oldcard), if (!oldcard || ! mmc_sd_alive(host)) >> or something. >> >> Thanks, >> Avri >> > Thank you for your suggestion. > I'm going to use it in mmc_rescan as below. > > e.g. > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index a8c17b4cd737..461cd75dc7ab 100644 > --- a/drivers/mmc/core/core.c > +++ b/drivers/mmc/core/core.c > @@ -2210,7 +2210,7 @@ void mmc_rescan(struct work_struct *work) > container_of(work, struct mmc_host, detect.work); > int i; > > - if (host->rescan_disable) > + if (host->rescan_disable || host->init_failed) > return; I've seen SD cards that fail the first initialization attempt for both 'valid' reasons (e.g. weird insertion timing) and things like out-of-spec initialization time from the card, outright disabling these on the first fail is a bit too much IMO. Kind Regards, Christian