Lines Matching refs:pdev
56 void __weak arch_setup_pdev_archdata(struct platform_device *pdev) in arch_setup_pdev_archdata() argument
189 struct platform_device pdev; member
200 void platform_device_put(struct platform_device *pdev) in platform_device_put() argument
202 if (pdev) in platform_device_put()
203 put_device(&pdev->dev); in platform_device_put()
210 pdev.dev); in platform_device_release()
212 of_device_node_put(&pa->pdev.dev); in platform_device_release()
213 kfree(pa->pdev.dev.platform_data); in platform_device_release()
214 kfree(pa->pdev.mfd_cell); in platform_device_release()
215 kfree(pa->pdev.resource); in platform_device_release()
216 kfree(pa->pdev.driver_override); in platform_device_release()
235 pa->pdev.name = pa->name; in platform_device_alloc()
236 pa->pdev.id = id; in platform_device_alloc()
237 device_initialize(&pa->pdev.dev); in platform_device_alloc()
238 pa->pdev.dev.release = platform_device_release; in platform_device_alloc()
239 arch_setup_pdev_archdata(&pa->pdev); in platform_device_alloc()
242 return pa ? &pa->pdev : NULL; in platform_device_alloc()
256 int platform_device_add_resources(struct platform_device *pdev, in platform_device_add_resources() argument
267 kfree(pdev->resource); in platform_device_add_resources()
268 pdev->resource = r; in platform_device_add_resources()
269 pdev->num_resources = num; in platform_device_add_resources()
284 int platform_device_add_data(struct platform_device *pdev, const void *data, in platform_device_add_data() argument
295 kfree(pdev->dev.platform_data); in platform_device_add_data()
296 pdev->dev.platform_data = d; in platform_device_add_data()
308 int platform_device_add(struct platform_device *pdev) in platform_device_add() argument
312 if (!pdev) in platform_device_add()
315 if (!pdev->dev.parent) in platform_device_add()
316 pdev->dev.parent = &platform_bus; in platform_device_add()
318 pdev->dev.bus = &platform_bus_type; in platform_device_add()
320 switch (pdev->id) { in platform_device_add()
322 dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); in platform_device_add()
325 dev_set_name(&pdev->dev, "%s", pdev->name); in platform_device_add()
336 pdev->id = ret; in platform_device_add()
337 pdev->id_auto = true; in platform_device_add()
338 dev_set_name(&pdev->dev, "%s.%d.auto", pdev->name, pdev->id); in platform_device_add()
342 for (i = 0; i < pdev->num_resources; i++) { in platform_device_add()
343 struct resource *p, *r = &pdev->resource[i]; in platform_device_add()
346 r->name = dev_name(&pdev->dev); in platform_device_add()
357 dev_err(&pdev->dev, "failed to claim resource %d\n", i); in platform_device_add()
364 dev_name(&pdev->dev), dev_name(pdev->dev.parent)); in platform_device_add()
366 ret = device_add(&pdev->dev); in platform_device_add()
371 if (pdev->id_auto) { in platform_device_add()
372 ida_simple_remove(&platform_devid_ida, pdev->id); in platform_device_add()
373 pdev->id = PLATFORM_DEVID_AUTO; in platform_device_add()
377 struct resource *r = &pdev->resource[i]; in platform_device_add()
395 void platform_device_del(struct platform_device *pdev) in platform_device_del() argument
399 if (pdev) { in platform_device_del()
400 device_del(&pdev->dev); in platform_device_del()
402 if (pdev->id_auto) { in platform_device_del()
403 ida_simple_remove(&platform_devid_ida, pdev->id); in platform_device_del()
404 pdev->id = PLATFORM_DEVID_AUTO; in platform_device_del()
407 for (i = 0; i < pdev->num_resources; i++) { in platform_device_del()
408 struct resource *r = &pdev->resource[i]; in platform_device_del()
420 int platform_device_register(struct platform_device *pdev) in platform_device_register() argument
422 device_initialize(&pdev->dev); in platform_device_register()
423 arch_setup_pdev_archdata(pdev); in platform_device_register()
424 return platform_device_add(pdev); in platform_device_register()
436 void platform_device_unregister(struct platform_device *pdev) in platform_device_unregister() argument
438 platform_device_del(pdev); in platform_device_unregister()
439 platform_device_put(pdev); in platform_device_unregister()
455 struct platform_device *pdev; in platform_device_register_full() local
457 pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id); in platform_device_register_full()
458 if (!pdev) in platform_device_register_full()
461 pdev->dev.parent = pdevinfo->parent; in platform_device_register_full()
462 pdev->dev.fwnode = pdevinfo->fwnode; in platform_device_register_full()
471 pdev->dev.dma_mask = in platform_device_register_full()
472 kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL); in platform_device_register_full()
473 if (!pdev->dev.dma_mask) in platform_device_register_full()
476 *pdev->dev.dma_mask = pdevinfo->dma_mask; in platform_device_register_full()
477 pdev->dev.coherent_dma_mask = pdevinfo->dma_mask; in platform_device_register_full()
480 ret = platform_device_add_resources(pdev, in platform_device_register_full()
485 ret = platform_device_add_data(pdev, in platform_device_register_full()
490 ret = platform_device_add(pdev); in platform_device_register_full()
493 ACPI_COMPANION_SET(&pdev->dev, NULL); in platform_device_register_full()
494 kfree(pdev->dev.dma_mask); in platform_device_register_full()
497 platform_device_put(pdev); in platform_device_register_full()
501 return pdev; in platform_device_register_full()
682 struct platform_device *pdev; in __platform_create_bundle() local
685 pdev = platform_device_alloc(driver->driver.name, -1); in __platform_create_bundle()
686 if (!pdev) { in __platform_create_bundle()
691 error = platform_device_add_resources(pdev, res, n_res); in __platform_create_bundle()
695 error = platform_device_add_data(pdev, data, size); in __platform_create_bundle()
699 error = platform_device_add(pdev); in __platform_create_bundle()
707 return pdev; in __platform_create_bundle()
710 platform_device_del(pdev); in __platform_create_bundle()
712 platform_device_put(pdev); in __platform_create_bundle()
788 struct platform_device *pdev = to_platform_device(dev); in modalias_show() local
799 len = snprintf(buf, PAGE_SIZE, "platform:%s\n", pdev->name); in modalias_show()
809 struct platform_device *pdev = to_platform_device(dev); in driver_override_store() local
810 char *driver_override, *old = pdev->driver_override, *cp; in driver_override_store()
824 pdev->driver_override = driver_override; in driver_override_store()
827 pdev->driver_override = NULL; in driver_override_store()
838 struct platform_device *pdev = to_platform_device(dev); in driver_override_show() local
840 return sprintf(buf, "%s\n", pdev->driver_override); in driver_override_show()
854 struct platform_device *pdev = to_platform_device(dev); in platform_uevent() local
867 pdev->name); in platform_uevent()
873 struct platform_device *pdev) in platform_match_id() argument
876 if (strcmp(pdev->name, id->name) == 0) { in platform_match_id()
877 pdev->id_entry = id; in platform_match_id()
900 struct platform_device *pdev = to_platform_device(dev); in platform_match() local
904 if (pdev->driver_override) in platform_match()
905 return !strcmp(pdev->driver_override, drv->name); in platform_match()
917 return platform_match_id(pdrv->id_table, pdev) != NULL; in platform_match()
920 return (strcmp(pdev->name, drv->name) == 0); in platform_match()
928 struct platform_device *pdev = to_platform_device(dev); in platform_legacy_suspend() local
932 ret = pdrv->suspend(pdev, mesg); in platform_legacy_suspend()
940 struct platform_device *pdev = to_platform_device(dev); in platform_legacy_resume() local
944 ret = pdrv->resume(pdev); in platform_legacy_resume()