Linux Kernel设备驱动模型之 总线查找驱动
来源:互联网 发布:mac如何修改照片像素 编辑:程序博客网 时间:2024/05/21 06:54
设备模型之总线查找驱动:
/** * bus_for_each_drv - driver iterator * @bus: bus we're dealing with. * @start: driver to start iterating on. * @data: data to pass to the callback. * @fn: function to call for each driver. * * This is nearly identical to the device iterator above. * We iterate over each driver that belongs to @bus, and call * @fn for each. If @fn returns anything but 0, we break out * and return it. If @start is not NULL, we use it as the head * of the list. * * NOTE: we don't return the driver that returns a non-zero * value, nor do we leave the reference count incremented for that * driver. If the caller needs to know that info, it must set it * in the callback. It must also be sure to increment the refcount * so it doesn't disappear before returning to the caller. */int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, void *data, int (*fn)(struct device_driver *, void *)){ struct klist_iter i; struct device_driver *drv; int error = 0;
if (!bus) return -EINVAL;
klist_iter_init_node(&bus->p->klist_drivers, &i, start ? &start->p->knode_bus : NULL); while ((drv = next_driver(&i)) && !error) error = fn(drv, data); klist_iter_exit(&i); return error;}
static struct device_driver *next_driver(struct klist_iter *i){ struct klist_node *n = klist_next(i); struct driver_private *drv_priv;
if (n) { drv_priv = container_of(n, struct driver_private, knode_bus); return drv_priv->driver; } return NULL;}
- Linux Kernel设备驱动模型之 总线查找驱动
- Linux Kernel设备驱动模型之总线查找设备
- Linux Kernel设备驱动模型之总线添加驱动
- Linux Kernel设备驱动模型之总线添加设备
- Linux Kernel设备驱动模型之 总线注册
- Linux Kernel设备驱动模型之总线初始化
- Linux Kernel设备驱动模型之class 查找设备
- linux设备总线驱动模型 之 platform总线驱动
- linux设备总线驱动模型 之 platform总线驱动
- linux设备总线驱动模型 之 platform总线驱动
- Linux设备驱动模型之platform总线
- Linux设备驱动模型之platform总线
- Linux驱动之设备模型(4)-总线
- Linux设备驱动模型之总线
- Linux驱动之设备模型(4)-总线
- Linux设备驱动模型之platform总线
- Linux设备驱动之七----总线设备驱动模型
- Linux Kernel 学习笔记16:总线设备驱动模型
- 【数据结构_不那么数据结构系列_1037】集合的并运算的实现
- img标签中的alt属性
- 利用hibernate 执行删除操作的异常问题
- 多线程_线程控制之礼让线程
- 特殊回文数
- Linux Kernel设备驱动模型之 总线查找驱动
- Swift3.1-根据类名动态创建类
- 项目经理基本职责
- 详细解析Java中抽象类和接口的区别
- lenovo台式机搭建vxworks开发环境
- mysql一键安装 各种版本操作
- hdu 1358 Period
- 顶端优势
- javaScript dom1