Skip to content

Commit 2cc83bf

Browse files
dennisszhouUlf Hansson
authored andcommitted
mmc: core: Allow mmc_start_host() synchronously detect a card
When using dm-verity with a data partition on an emmc device, dm-verity races with the initialization of the (e)MMC/SD cards. This is because the card detection procedure is being managed from a workqueue, rather than synchronously from the mmc host's ->probe() routine. To allow the card detect to be synchronous, let's simply skip using the workqueue at the first initialization attempt from mmc_start_host(). Signed-off-by: Dennis Zhou <dennis@kernel.org> Link: https://lore.kernel.org/r/ZCTOMVjW+pnZVGsQ@snowbird [Ulf: Re-wrote the commit message to clarify the change] Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 3108eb2 commit 2cc83bf

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

drivers/mmc/core/core.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,10 +2199,8 @@ int mmc_card_alternative_gpt_sector(struct mmc_card *card, sector_t *gpt_sector)
21992199
}
22002200
EXPORT_SYMBOL(mmc_card_alternative_gpt_sector);
22012201

2202-
void mmc_rescan(struct work_struct *work)
2202+
static void __mmc_rescan(struct mmc_host *host)
22032203
{
2204-
struct mmc_host *host =
2205-
container_of(work, struct mmc_host, detect.work);
22062204
int i;
22072205

22082206
if (host->rescan_disable)
@@ -2274,6 +2272,14 @@ void mmc_rescan(struct work_struct *work)
22742272
mmc_schedule_delayed_work(&host->detect, HZ);
22752273
}
22762274

2275+
void mmc_rescan(struct work_struct *work)
2276+
{
2277+
struct mmc_host *host =
2278+
container_of(work, struct mmc_host, detect.work);
2279+
2280+
__mmc_rescan(host);
2281+
}
2282+
22772283
void mmc_start_host(struct mmc_host *host)
22782284
{
22792285
host->f_init = max(min(freqs[0], host->f_max), host->f_min);
@@ -2286,7 +2292,8 @@ void mmc_start_host(struct mmc_host *host)
22862292
}
22872293

22882294
mmc_gpiod_request_cd_irq(host);
2289-
_mmc_detect_change(host, 0, false);
2295+
host->detect_change = 1;
2296+
__mmc_rescan(host);
22902297
}
22912298

22922299
void __mmc_stop_host(struct mmc_host *host)

0 commit comments

Comments
 (0)