Lines Matching refs:dev

47 	struct device *dev;  in of_find_device_by_node()  local
49 dev = bus_find_device_by_of_node(&platform_bus_type, np); in of_find_device_by_node()
50 return dev ? to_platform_device(dev) : NULL; in of_find_device_by_node()
56 BUG_ON(ofdev->dev.of_node == NULL); in of_device_add()
60 ofdev->name = dev_name(&ofdev->dev); in of_device_add()
68 set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node)); in of_device_add()
70 return device_add(&ofdev->dev); in of_device_add()
75 device_initialize(&pdev->dev); in of_device_register()
82 device_unregister(&ofdev->dev); in of_device_unregister()
108 static void of_device_make_bus_id(struct device *dev) in of_device_make_bus_id() argument
110 struct device_node *node = dev->of_node; in of_device_make_bus_id()
124 dev_set_name(dev, dev_name(dev) ? "%llx.%x.%pOFn:%s" : "%llx.%x.%pOFn", in of_device_make_bus_id()
125 addr, ffs(mask) - 1, node, dev_name(dev)); in of_device_make_bus_id()
128 dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn", in of_device_make_bus_id()
129 addr, node, dev_name(dev)); in of_device_make_bus_id()
134 dev_set_name(dev, dev_name(dev) ? "%s:%s" : "%s", in of_device_make_bus_id()
135 kbasename(node->full_name), dev_name(dev)); in of_device_make_bus_id()
150 struct platform_device *dev; in of_device_alloc() local
154 dev = platform_device_alloc("", PLATFORM_DEVID_NONE); in of_device_alloc()
155 if (!dev) in of_device_alloc()
165 platform_device_put(dev); in of_device_alloc()
169 dev->num_resources = num_reg; in of_device_alloc()
170 dev->resource = res; in of_device_alloc()
178 device_set_node(&dev->dev, of_fwnode_handle(of_node_get(np))); in of_device_alloc()
179 dev->dev.parent = parent ? : &platform_bus; in of_device_alloc()
182 dev_set_name(&dev->dev, "%s", bus_id); in of_device_alloc()
184 of_device_make_bus_id(&dev->dev); in of_device_alloc()
186 return dev; in of_device_alloc()
206 struct platform_device *dev; in of_platform_device_create_pdata() local
212 dev = of_device_alloc(np, bus_id, parent); in of_platform_device_create_pdata()
213 if (!dev) in of_platform_device_create_pdata()
216 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); in of_platform_device_create_pdata()
217 if (!dev->dev.dma_mask) in of_platform_device_create_pdata()
218 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; in of_platform_device_create_pdata()
219 dev->dev.bus = &platform_bus_type; in of_platform_device_create_pdata()
220 dev->dev.platform_data = platform_data; in of_platform_device_create_pdata()
221 of_msi_configure(&dev->dev, dev->dev.of_node); in of_platform_device_create_pdata()
223 if (of_device_add(dev) != 0) { in of_platform_device_create_pdata()
224 platform_device_put(dev); in of_platform_device_create_pdata()
228 return dev; in of_platform_device_create_pdata()
258 struct amba_device *dev; in of_amba_device_create() local
267 dev = amba_device_alloc(NULL, 0, 0); in of_amba_device_create()
268 if (!dev) in of_amba_device_create()
272 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); in of_amba_device_create()
273 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; in of_amba_device_create()
276 device_set_node(&dev->dev, of_fwnode_handle(of_node_get(node))); in of_amba_device_create()
277 dev->dev.parent = parent ? : &platform_bus; in of_amba_device_create()
278 dev->dev.platform_data = platform_data; in of_amba_device_create()
280 dev_set_name(&dev->dev, "%s", bus_id); in of_amba_device_create()
282 of_device_make_bus_id(&dev->dev); in of_amba_device_create()
285 of_property_read_u32(node, "arm,primecell-periphid", &dev->periphid); in of_amba_device_create()
287 ret = of_address_to_resource(node, 0, &dev->res); in of_amba_device_create()
294 ret = amba_device_add(dev, &iomem_resource); in of_amba_device_create()
301 return dev; in of_amba_device_create()
304 amba_device_put(dev); in of_amba_device_create()
379 struct platform_device *dev; in of_platform_bus_create() local
418 dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent); in of_platform_bus_create()
419 if (!dev || !of_match_node(matches, bus)) in of_platform_bus_create()
424 rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict); in of_platform_bus_create()
557 struct platform_device *dev; in of_platform_default_populate_init() local
570 dev = platform_device_alloc("bootx-noscreen", 0); in of_platform_default_populate_init()
571 if (WARN_ON(!dev)) in of_platform_default_populate_init()
573 ret = platform_device_add(dev); in of_platform_default_populate_init()
575 platform_device_put(dev); in of_platform_default_populate_init()
589 dev = of_platform_device_create(node, "of-display", NULL); in of_platform_default_populate_init()
591 if (WARN_ON(!dev)) in of_platform_default_populate_init()
642 int of_platform_device_destroy(struct device *dev, void *data) in of_platform_device_destroy() argument
645 if (!dev->of_node || !of_node_check_flag(dev->of_node, OF_POPULATED)) in of_platform_device_destroy()
649 if (of_node_check_flag(dev->of_node, OF_POPULATED_BUS)) in of_platform_device_destroy()
650 device_for_each_child(dev, NULL, of_platform_device_destroy); in of_platform_device_destroy()
652 of_node_clear_flag(dev->of_node, OF_POPULATED); in of_platform_device_destroy()
653 of_node_clear_flag(dev->of_node, OF_POPULATED_BUS); in of_platform_device_destroy()
655 if (dev->bus == &platform_bus_type) in of_platform_device_destroy()
656 platform_device_unregister(to_platform_device(dev)); in of_platform_device_destroy()
658 else if (dev->bus == &amba_bustype) in of_platform_device_destroy()
659 amba_device_unregister(to_amba_device(dev)); in of_platform_device_destroy()
684 static void devm_of_platform_populate_release(struct device *dev, void *res) in devm_of_platform_populate_release() argument
698 int devm_of_platform_populate(struct device *dev) in devm_of_platform_populate() argument
703 if (!dev) in devm_of_platform_populate()
711 ret = of_platform_populate(dev->of_node, NULL, NULL, dev); in devm_of_platform_populate()
715 *ptr = dev; in devm_of_platform_populate()
716 devres_add(dev, ptr); in devm_of_platform_populate()
723 static int devm_of_platform_match(struct device *dev, void *res, void *data) in devm_of_platform_match() argument
744 void devm_of_platform_depopulate(struct device *dev) in devm_of_platform_depopulate() argument
748 ret = devres_release(dev, devm_of_platform_populate_release, in devm_of_platform_depopulate()
749 devm_of_platform_match, dev); in devm_of_platform_depopulate()
781 pdev_parent ? &pdev_parent->dev : NULL); in of_platform_notify()
804 of_platform_device_destroy(&pdev->dev, &children_left); in of_platform_notify()