question about mmc_rescan function
Chan Kim
ckim at etri.re.kr
Sat Jul 12 01:53:49 EDT 2014
Hi,
I found the mmc_rescan function is called periodically.
and the only place I can see the name is this line below in the mmc_alloc_host function
INIT_DELAYED_WORK(&host->detect, mmc_rescan);
so it is regsitered as a delayed work in mmc_host.
And at the end of mmc_rescan, I see
mmc_schedule_delayed_work(&host->detect, HZ);
Q1 : Is this how it is called periodically every second? I guess so..
In the SD host driver, in initial slot initialization, there is
mcc_host_add which eventually schedules mmc_rescan.
(mmc_add_host -> mmc_start_host -> mmc_detect_change -> mmc_schedule_delayed_work(&host->detect, delay))
and towards the end of this initial slot initialization, there is
queue_work(my_workqueue, &host->card_work);
And the card_work is a function supposed to be called when a card is inserted or removed.
In the card_work, there is at the end
mmc_detect_change(slot->mmc, msecs_to_jiffies(host->pdata->detect_delay_ms));
and inside mmc_detect_change, mmc_schedule_delayed_work(&host->detect, delay); is called which is mmc_rescan.
Q2 : Is there something wrong (mmc_rescan is started and schedule itself by mmc_add_host, but it is started by another card_work)? I tried removing queue_work and it still seems to work..
can anybody confirm or tell me anything?
best regards,
Chan
More information about the Kernelnewbies
mailing list