[PATCH v2 3/4] staging: vchiq: Simplify platform devices registration

From: Umang Jain
Date: Thu Dec 22 2022 - 14:15:40 EST


The child platform devices registered by the vchiq driver currently
populates a struct platform_device_info with a name and parent device
and uses platform_device_register_full() to its registration.

It can be simplified by using platform_device_register_data() directly
(which encapsulates populating the platform_device_info struct and a
platform_device_register_full() call in itself).

Signed-off-by: Umang Jain <umang.jain@xxxxxxxxxxxxxxxx>
---
.../vc04_services/interface/vchiq_arm/vchiq_arm.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 3c4766375daa..ba34e4d603d4 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1766,16 +1766,10 @@ MODULE_DEVICE_TABLE(of, vchiq_of_match);
static struct platform_device *
vchiq_register_child(struct platform_device *pdev, const char *name)
{
- struct platform_device_info pdevinfo;
struct platform_device *child;

- memset(&pdevinfo, 0, sizeof(pdevinfo));
-
- pdevinfo.parent = &pdev->dev;
- pdevinfo.name = name;
- pdevinfo.id = PLATFORM_DEVID_NONE;
-
- child = platform_device_register_full(&pdevinfo);
+ child = platform_device_register_data(&pdev->dev, name, PLATFORM_DEVID_NONE,
+ NULL, 0);
if (IS_ERR(child)) {
dev_warn(&pdev->dev, "%s not registered\n", name);
platform_device_put(child);
--
2.38.1