*参照元 [#a7c39a68] #backlinks *説明 [#ceae9bcd] -パス: [[linux-4.4.1/drivers/of/platform.c]] -FIXME: これは何? --説明 **引数 [#e1ba0868] -struct device_node *np -- --[[linux-4.4.1/device_node]] -const char *bus_id -- -void *platform_data -- -struct device *parent -- --[[linux-4.4.1/device]] **返り値 [#w3fa5c34] -struct platform_device * -- --[[linux-4.4.1/device]] **参考 [#yc05c84c] *実装 [#vdb349a9] /** * of_platform_device_create_pdata - Alloc, initialize and register an of_device * @np: pointer to node to create device for * @bus_id: name to assign device * @platform_data: pointer to populate platform_data pointer with * @parent: Linux device model parent device. * * Returns pointer to created platform device, or NULL if a device was not * registered. Unavailable devices will not get registered. */ static struct platform_device *of_platform_device_create_pdata( struct device_node *np, const char *bus_id, void *platform_data, struct device *parent) { struct platform_device *dev; if (!of_device_is_available(np) || of_node_test_and_set_flag(np, OF_POPULATED)) return NULL; - --[[linux-4.4.1/of_device_is_available()]] --[[linux-4.4.1/of_node_test_and_set_flag()]] dev = of_device_alloc(np, bus_id, parent); if (!dev) goto err_clear_flag; - --[[linux-4.4.1/of_device_alloc()]] dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data; of_dma_configure(&dev->dev, dev->dev.of_node); of_msi_configure(&dev->dev, dev->dev.of_node); - --[[linux-4.4.1/platform_bus_type(global)]] --[[linux-4.4.1/of_dma_configure()]] --[[linux-4.4.1/of_msi_configure()]] if (of_device_add(dev) != 0) { of_dma_deconfigure(&dev->dev); platform_device_put(dev); goto err_clear_flag; } - --[[linux-4.4.1/of_device_add()]] --[[linux-4.4.1/of_dma_deconfigure()]] --[[linux-4.4.1/platform_device_put()]] return dev; err_clear_flag: of_node_clear_flag(np, OF_POPULATED); return NULL; - --[[linux-4.4.1/of_node_clear_flag()]] } *コメント [#nc5d0104]