dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent); // 生成bus节点的platform_device结构体 if (!dev || !of_match_node(matches, bus)) // 如果bus节点的compatile属性不吻合matches成表, 就不处理它的子节点 return 0; for_each_child_of_node(bus, child) { // 取出...
of_find_matching_node_and_match通过 of_device_id 匹配表来查找指定的节点,函数原型如下: structdevice_node *of_find_matching_node_and_match(structdevice_node *from,conststructof_device_id *matches,conststructof_device_id `match); 函数参数和返回值含义如下: from:开始查找的节点,如果为 NULL 表示从...
struct device_node *of_find_matching_node_and_match(struct device_node *from,const struct of_device_id *matches, const struct of_device_id **match) 函数参数和返回值含义如下: from:开始查找的节点,如果为 NULL 表示从根节点开始查找整个设备树。 matches: of_device_id 匹配表,也就是在此匹配表里面...
static inline int of_driver_match_device(struct device *dev,const struct device_driver *drv) { return of_match_device(drv->of_match_table, dev) != NULL; } if (of_driver_match_device(dev, drv)) return 1; 1. 2. 3. 4. 5. 6. 匹配规则3 (1)这一条很多人都是直接一句ACPI 匹配方式...
match: 找到的匹配的 of_device_id; 成功返回找到的节点,失败时返回NULL。 二、获取父子设备节点API 2.1 of_get_parent of_find_node_by_path函数用于获取某一节点的父节点,函数原型: struct device_node *of_get_parent(const struct device_node *node); ...
int of_alias_get_id(struct device_node *np, const char *stem) 获取节点np对应的aliasid号 struct device_node* of_node_get(struct device_node *node) void of_node_put(struct device_node *node) device node计数增加/减少 const struct of_device_id* of_match_node(const struct of_device_id ...
/ { chosen { stdout-path = &uart1; }; memory@80000000 { device_type = "memory"; reg = <0x80000000 0x20000000>; }; reserved-memory { #address-cells = <1>; #size-cells = <1>; ranges; linux,cma { compatible = "shared-dma-pool"; reusable; size = <0xa000000>; linux,cma-...
第6行,通过MODULE_DEVICE_TABLE声明一下leds_of_match这个设备匹配表。第11行,设置platform_driver中的of_match_table匹配表为上面创建的leds_of_match,至此我们就设置好了platform驱动的匹配表了。3、编写platform驱动 基于设备树的platform驱动和上一章无设备树的platform驱动基本一样,都是当驱动和设备匹配成功以后...
of_find_compatible_node 函数根据 device_type 和 compatible 这两个属性查找指定的节点,函数原型如下: struct device_node *of_find_compatible_node(struct device_node *from,const char *type, const char *compatible); (4)of_find_matching_node_and_match 函数 ...
of_find_matching_node_and_match 函数通过 of_device_id 匹配表来查找指定的节点,函数原型如下: 代码语言:javascript 复制 struct device_node*of_find_matching_node_and_match(struct device_node*from,conststruct of_device_id*matches,conststruct of_device_id**match); ...