- int platform_driver_register(struct platform_driver *drv)
- {
- drv->driver.bus = &platform_bus_type;
- if (drv->probe)
- drv->driver.probe = platform_drv_probe;
- if (drv->remove)
- drv->driver.remove = platform_drv_remove;
- if (drv->shutdown)
- drv->driver.shutdown = platform_drv_shutdown;
- if (drv->suspend)
- drv->driver.suspend = platform_drv_suspend;
- if (drv->resume)
- drv->driver.resume = platform_drv_resume;
- return driver_register(&drv->driver);
- }
先初始化platform_driver里的driver,该driver的类型为device_driver,设置driver的bus为platform_bus_type;设置driver的probe为platform_drv_probe;设置driver的remove为platform_drv_remove;设置driver的shutdown为platform_drv_shutdown;设置driver的suspend为platform_drv_suspend;设置driver的resume为platform_drv_resume,最后调用driver_register函数来注册平台驱动。
相反地,要刊出平台驱动的话,应用platform_driver_unregister函数
platform_device_del函数调用device_del函数来删除平台设备,响应地,要释放资本竽暌功调用release_resource函数,前提是资本的类型必须为IORESOURCE_MEM或者IORESOURCE_IO
- void platform_driver_unregister(struct platform_driver *drv)
- {
- driver_unregister(&drv->driver);
- }
【编辑推荐】
- Linux体系启动故障若何修复?这几个案例帮你解决问题~
- 面试Linux运维必定会问到Shell脚本的┞封24个问题
- Linux内核4.14宣布:快来看看Linus的总结和超多新特点
- 慕尼黑放弃 Linux,2020 年或将周全迁入 Windows
- Linux Lite第一个支撑Linux 4.14及若何安装
推荐阅读
Linux Lite第一个支持Linux 4.14及如何安装
Tech Neo技巧沙龙 | 11月25号,九州云/ZStack与您一路商量云时代收集界线治理实践 Linux Lite保护者Jerry Bezencon再次初次在Twitter上宣布他的基于Ubuntu的发行版的软件库中最新的Linux内>>>详细阅读
本文标题:Linux平台总线驱动设备模型
地址:http://www.17bianji.com/lsqh/38937.html
1/2 1