目录
1. 简介
在前文的1.2节 mmc子系统如何区分使用哪种card的?(mmc_rescan)中我们讲了如何区分插入的是哪种类型的卡片。那么如何进行检测呢?即如何检测到卡槽里面插入了卡,最终调用mmc_rescan呢?
struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
{
.......
INIT_DELAYED_WORK(&host->detect, mmc_rescan);
........
return host;
}
在mmc_alloc_host函数中,mmc_rescan是&host->detect的执行函数,那边我们看看&host->detect什么时候调用。最终发现被_mmc_detect_change调用。
static void _mmc_detect_change(struct mmc_host *host, unsigned long delay,
bool cd_irq)
{
/*
* If the device is configured as wakeup, we prevent a new sleep for
* 5 s to give provision for user space to consume the event.
*/
if (