zoukankan      html  css  js  c++  java
  • Platform驱动模型匹配过程

    #device方面:
    platform_device_register(struct platform_device *dev)
    ------platform_device_add(pdev);
    ----------device_add(&pdev->dev);
    --------------bus_probe_device(dev);
    -------------------device_attach(dev);
    -------------------------bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
    -------------------------------driver_match_device(drv, dev);成功才向下执行probe!
    -------------------------------------driver_probe_device(drv, dev);
    --------------------------------------------really_probe(dev, drv);
    ----------------------------------------------------dev->bus->probe(dev);或者drv->probe(dev);platform_device_add(pdev);
    
    #driver方面:
    platform_driver_register(struct platform_driver * drv)
    --------driver_register(&drv->driver);
    ------------bus_add_driver(drv);
    -----------------driver_attach(drv);
    ------------------------bus_for_each_dev(drv->bus, NULL, drv, __driver_attach); 遍历所有节点!
    -------------------------------driver_match_device(drv, dev);成功才向下执行probe!
    ---------------------------------------driver_probe_device(drv, dev);
    ------------------------------------------------really_probe(dev, drv);
    ---------------------------------------------------------dev->bus->probe(dev);或者drv->probe(dev);
    
    
    
    driver_match_device()  是匹配的关键,实质是上执行:
    --------return drv->bus->match ? drv->bus->match(dev, drv) : 1;
    ------------------.match = platform_match  最终调用bus中的platform_match函数来匹配。
    
    
    bus_for_each_drv/dev()  函数中:
    ---------while ((dev = next_device(&i)) && !error)  遍历所有节点;
    
  • 相关阅读:
    react路由组件&&非路由组件
    react函数式组件(非路由组件)实现路由跳转
    react使用antd组件递归实现左侧菜单导航树
    【LeetCode】65. Valid Number
    【LeetCode】66. Plus One (2 solutions)
    【LeetCode】68. Text Justification
    【LeetCode】69. Sqrt(x) (2 solutions)
    【LeetCode】72. Edit Distance
    【LeetCode】73. Set Matrix Zeroes (2 solutions)
    【LeetCode】76. Minimum Window Substring
  • 原文地址:https://www.cnblogs.com/retry/p/11934857.html
Copyright © 2011-2022 走看看