注册驱动时如何调用probe函数 ?
platform_driver_register
driver_register
bus_add_driver //把驱动放入总线的驱动链表里
driver_attach
bus_for_each_dev(drv->bus, NULL, drv, __driver_attach);//遍历该总线上所有的device,执行一次__driver_attach(),看能不能将驱动关联(attach)到某个设备上去。
__driver_attach
driver_probe_device(drv, dev)
if (drv->bus->match && !drv->bus->match(dev, drv)) //调用驱动的总线上的match函数,查看驱动与设备是否匹配
goto done;
really_probe(dev, drv);
if (dev->bus->probe) {
ret = dev->bus->probe(dev); //(如果bus->probe非空,则调用bus->probe)
if (ret)
goto probe_failed;
}
else if (drv->probe)
{
ret = drv->probe(dev); //调用驱动的probe函数
if (ret)
goto probe_failed;
}
总结,注册一个某个bus的驱动就是先把驱动自己链入到bus驱动链表中去,
在从bus的设备链表中一一寻找,看有没有自己可以关联上的设备。找到就probe,
再把二者bind起来。反之,添加设备道理也是一样的。
选中代码后,按tab键,整体后移;按shift + tab键,整体前移
注册驱动时如何调用probe函数 ?的更多相关文章
- (转)platform_driver_register,什么时候调用PROBE函数 注册后如何找到驱动匹配的设备
platform_driver_register,什么时候调用PROBE函数 注册后如何找到驱动匹配的设备 2011-10-24 19:47:07 分类: LINUX kernel_init中d ...
- platform_driver_register,什么时候调用PROBE函数 注册后如何找到驱动匹配的设备【转】
转自:http://blog.chinaunix.net/uid-25508271-id-2979412.html kernel_init中do_basic_setup()->driver_in ...
- platform_device和platform_driver的注册过程,及probe函数何时调用的分析 ⭐⭐⭐
add platform_device之后,需要注意的一个地方是这里,add是通过系统初始化里边调用platform_add_devices把所有放置在板级platform_device数组中的所有 ...
- platform驱动之probe函数
驱动注册的probe函数 probe函数在设备驱动注册最后收尾工作,当设备的device 和其对应的driver 在总线上完成配对之后,系统就调用platform设备的probe函数完成驱动注册最后工 ...
- linux中probe函数中传递的参数来源(上)
点击打开链接 上一篇中,我们追踪了probe函数在何时调用,知道了满足什么条件会调用probe函数,但probe函数中传递的参数我们并不知道在何时定义,到底是谁定义的,反正不是我们在驱动中定义的(当然 ...
- platform_driver_register()--如何match之后调用probe
int platform_driver_register(struct platform_driver *drv) { drv->driver.bus = &platform_bus_t ...
- Samsung_tiny4412(驱动笔记03)----字符设备驱动基本操作及调用流程
/*********************************************************************************** * * 字符设备驱动基本操作及 ...
- probe函数何时调用的
转自:http://blog.csdn.net/xiafeng1113/article/details/8030248 Linux中 probe函数何时调用的 所以的驱动教程上都说:只有设备和驱动的名 ...
- linux中 probe函数的何时调用的?
点击打开链接 linux中 probe函数何时调用的 所以的驱动教程上都说:只有设备和驱动的名字匹配,BUS就会调用驱动的probe函数,但是有时我们要看看probe函数里面到底做了什么,还有传递给p ...
随机推荐
- input text 不显示输入的历史记录
当之前的text框输入了数据后,下次输入有历史记录问题的解决方法 怎么禁止输入框记录输入记录,双击input出现输入过的记录, 有过表单设计经验的朋友肯定知道,当我们在浏览器中输入表单信息的时候,往往 ...
- Agilent RF fundamentals (9)-Mixer basics
Function: change the frequency of the incident RF key parameters ----------------------------------- ...
- 记录下jplayer的简单demo
jplay一个播放器的工具包,依赖于jquery或者zepto,有zepto所以相当于是PC和移动都支持. 它的官方文档为:http://www.jplayer.cn/ 同时也推出的react的支持包 ...
- main(int argc, char *argv[])详解
argc是命令行总的参数个数 argv[]是argc个参数,其中第0个参数是程序的全名,以后的参数 命令行后面跟的用户输入的参数,比如: int main(int ar ...
- 解决问题:zipimport.ZipImportError: can't decompress data; zlib not available
场景描述 需要从源代码编译安装python-3.6.1的版本 环境描述 python-2.7.5, Centos 7 步骤重复 解压缩python-xx.tgz 进入源代码目录 ./configure ...
- Leetcode 589. N-ary Tree Preorder Traversal
DFS,两种实现方式,递归和栈. """ # Definition for a Node. class Node: def __init__(self, val, chi ...
- DataTable / DataSet 与 xml 的相互转换
之前做DataTable和DataSet转xml一直使用XmlSerializer 序列化完成.今天发现新方法,哇咔咔方便了很多.还不用担心Name为空时报错 static void Main(str ...
- 把UIImage保存到照片库和沙盒中
1.保存到iOS照片库需要引入QuartzCore.framework框架,具体代码如下: .h文件 #import <QuartzCore/QuartzCore.h> UIImageVi ...
- wifi文件传输
步骤: 1.下载CocoaHTTPServer 2.解压后,将CocoaHTTPServer-master目录下的Core导入工程. 3.打开Samples/SimpleFileUploadServe ...
- LeetCode Design Log Storage System
原题链接在这里:https://leetcode.com/problems/design-log-storage-system/description/ 题目: You are given sever ...