zoukankan      html  css  js  c++  java
  • [driver] probe调用的时机

    设备驱动probe的时机有如下几种(分为自动触发和手动触发):

    • 将struct device类型的变量注册到内核中时自动触发(device_register,device_add,device_create_vargs,device_create)
    • 将struct device_driver类型的变量注册到内核中时自动触发(driver_register)
    • 手动查找同一bus下的所有device_driver,如果有和指定device同名的driver,执行probe操作(device_attach)
    • 手动查找同一bus下的所有device,如果有和指定driver同名的device,执行probe操作(driver_attach)
    • 自行调用driver的probe接口,并在该接口中将该driver绑定到某个device结构中----即设置dev->driver(device_bind_driver)

    注1:probe动作实际是由bus模块(会在下一篇文章讲解)实现的,这不难理解:device和device_driver都是挂载在bus这根线上,因此只有bus最清楚应该为哪些device、哪些driver配对。

    注2:每个bus都有一个drivers_autoprobe变量,用于控制是否在device或者driver注册时,自动probe。该变量默认为1(即自动probe),bus模块将它开放到sysfs中了,因而可在用户空间修改,进而控制probe行为。

  • 相关阅读:
    1094. Car Pooling
    121. Best Time to Buy and Sell Stock
    58. Length of Last Word
    510. Inorder Successor in BST II
    198. House Robber
    57. Insert Interval
    15. 3Sum java solutions
    79. Word Search java solutions
    80. Remove Duplicates from Sorted Array II java solutions
    34. Search for a Range java solutions
  • 原文地址:https://www.cnblogs.com/aaronbin/p/15356938.html
Copyright © 2011-2022 走看看