linux mmc设备挂载流程解析
来源:互联网 发布:淘宝宝贝图片尺寸教程 编辑:程序博客网 时间:2024/04/30 05:54
linux的emmc驱动在drivers\mmc\card\block.c,其mmc_dirver结构体如下:
根据以往平台总线驱动模型的经验来看的话,内核里应该有mmc_devices结构体,并且
其name也为"mmcblk",这样其probe函数将被调用,但是搜索整个内核文件并没有发现mmc_devices。
现在我们分析一下mmc_blk_probe什么时候被调用。
static int __init mmc_blk_init(void) //drivers\mmc\card\block.c
{
res = mmc_register_driver(&mmc_driver); //注册mmc_driver
}
int mmc_register_driver(struct mmc_driver *drv) //drivers\mmc\core\bus.c
{
drv->drv.bus = &mmc_bus_type; //mmc设备是挂载在mmc总线上的
return driver_register(&drv->drv); //注册mmc驱动
}
int driver_register(struct device_driver *drv) //drivers\base\driver.c
{
other = driver_find(drv->name, drv->bus); //在总线上查找是否已经注册过此驱动
if (other) {
put_driver(other);
printk(KERN_ERR "Error: Driver '%s' is already registered, "
"aborting...\n", drv->name);
return -EBUSY;
}
ret = bus_add_driver(drv); //如果没有注册过,则注册此驱动
}
int bus_add_driver(struct device_driver *drv) //drivers\base\bus.c
{
error = driver_attach(drv);
error = driver_create_file(drv, &driver_attr_uevent);
}
//try to bind driver to devices
int driver_attach(struct device_driver *drv) //drivers/base/dd.c
{
return bus_for_each_dev(drv->bus, NULL, drv, __driver_attach);
//__driver_attach的里面device的查找还没搞清楚
}
static int __driver_attach(struct device *dev, void *data) //drivers/base/dd.c
{
if (!driver_match_device(drv, dev))
return 0;
driver_probe_device(drv, dev);
}
static inline int driver_match_device(struct device_driver *drv, //drivers/base/base.h
struct device *dev)
{
//这里调用了mmc总线的match函数
return drv->bus->match ? drv->bus->match(dev, drv) : 1;
}
static int mmc_bus_match(struct device *dev, struct device_driver *drv) //drivers\mmc\core\bus.c
{
//mmc总线的match直接返回了1
return 1;
}
int driver_probe_device(struct device_driver *drv, struct device *dev) //drivers/base/dd.c
{
really_probe(dev, drv);
}
static int really_probe(struct device *dev, struct device_driver *drv) //drivers/base/dd.c
{
dev->bus->probe(dev); //这里调用总线的probe函数
}
static int mmc_bus_probe(struct device *dev) //drivers\mmc\core\bus.c
{
return drv->probe(card); //最终mmc总线的probe函数调用mmc_driver的probe函数
}
- linux mmc设备挂载流程解析
- mmc流程
- [linux驱动]mmc读写过程解析
- linux设备模型之mmc,sd子系统<一>
- linux设备模型之mmc,sd子系统<二>
- linux设备模型之mmc,sd子系统<三>
- Linux设备驱动程序架构分析之MMC/SD(一)
- Linux设备驱动程序架构分析之MMC/SD(二)
- Linux设备驱动程序架构分析之MMC/SD(一)
- linux开机启动挂载mmc错误解决
- linux-mmc
- mmc驱动工作流程
- linux 设备树解析
- Linux设备树解析
- Linux设备树解析
- Linux设备驱动工作流程
- linux块设备读写流程
- Linux 字符设备驱动程序流程
- Android项目重构之路:实现篇
- 使用Asp.net WebAPI 快速构建后台数据接口
- Vue入门代码的一天
- Jenkins 自动化构建与部署
- Makefile详解-环境变量MAKEFILES
- linux mmc设备挂载流程解析
- image watch
- Malvern Bancorp报告收益
- flask-Bootstrap
- 【TensorFlow动手玩】数据导入1
- Mac终端写c程序
- 解决:ListView+CheckBox 点击错乱问题
- 使用多线程实现文件的复制功能,并在控制台显示复制的进度,进度以百分比表示。例如:把文件A复制到E盘某文件夹下,在控制台上显示“文件已复制10%”,“文件已复制20%”……“文件已复制100%”,“复制
- 开源新浪微博Android客户端