Linux内核4.14版本——mmc core(6)——mmc core主模块(2)card检测

本文介绍Linux内核4.14中 mmc core如何检测插入的卡片。通过mmc_rescan函数及其子函数mmc_rescan_try_freq,详细阐述了检测过程,该函数在mmc_alloc_host中被配置为检测函数,并由_mmc_detect_change触发执行。
摘要由CSDN通过智能技术生成

目录

1. 简介

 2. mmc_rescan

2.1 mmc_rescan_try_freq


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 (
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值