*参照元 [#x4be5a2e] #backlinks *説明 [#qfcb6b7a] -パス: [[linux-4.4.1/drivers/of/platform.c]] -FIXME: これは何? --説明 **引数 [#aa80daaf] -struct device_node *bus -- --[[linux-4.4.1/device_node]] -const struct of_device_id *matches -- --[[linux-4.4.1/of_device_id]] -const struct of_dev_auxdata *lookup -- --[[linux-4.4.1/of_dev_auxdata]] -struct device *parent -- --[[linux-4.4.1/device]] -bool strict -- **返り値 [#a6c7e460] -int -- **参考 [#xd434490] *実装 [#j3e052f0] /** * of_platform_bus_create() - Create a device for a node and its children. * @bus: device node of the bus to instantiate * @matches: match table for bus nodes * @lookup: auxdata table for matching id and platform_data with device nodes * @parent: parent for new device, or NULL for top level. * @strict: require compatible property * * Creates a platform_device for the provided device_node, and optionally * recursively create devices for all the child nodes. */ static int of_platform_bus_create(struct device_node *bus, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, struct device *parent, bool strict) { const struct of_dev_auxdata *auxdata; struct device_node *child; struct platform_device *dev; const char *bus_id = NULL; void *platform_data = NULL; int rc = 0; - --[[linux-4.4.1/of_dev_auxdata]] --[[linux-4.4.1/devie_node]] --[[linux-4.4.1/platform_device]] /* Make sure it has a compatible property */ if (strict && (!of_get_property(bus, "compatible", NULL))) { pr_debug("%s() - skipping %s, no compatible prop\n", __func__, bus->full_name); return 0; } - --[[linux-4.4.1/of_get_property()]] --[[linux-4.4.1/pr_debug()]] auxdata = of_dev_lookup(lookup, bus); if (auxdata) { bus_id = auxdata->name; platform_data = auxdata->platform_data; } - --[[linux-4.4.1/of_dev_lookup()]] if (of_device_is_compatible(bus, "arm,primecell")) { /* * Don't return an error here to keep compatibility with older * device tree files. */ of_amba_device_create(bus, bus_id, platform_data, parent); return 0; } - --[[linux-4.4.1/of_device_is_compatible()]] --[[linux-4.4.1/of_amba_device_create()]] dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent); if (!dev || !of_match_node(matches, bus)) return 0; - --[[linux-4.4.1/of_platform_device_create_pdata()]] --[[linux-4.4.1/of_match_node()]] for_each_child_of_node(bus, child) { pr_debug(" create child: %s\n", child->full_name); rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict); if (rc) { of_node_put(child); break; } } of_node_set_flag(bus, OF_POPULATED_BUS); - --[[linux-4.4.1/for_each_child_of_node()]] --[[linux-4.4.1/of_platform_bus_create()]] --[[linux-4.4.1/of_node_put()]] --[[linux-4.4.1/of_node_set_flag()]] return rc; } *コメント [#u688871d]