On Thu, 28 May 2026 14:35:50 +0200, "Ilpo Järvinen" <[email protected]> said: > On Wed, 13 May 2026, Bartosz Golaszewski wrote: > >> Creating a software node for a given set of properties and adding it to >> a platform device can be achieved with a single call to >> platform_device_register_full(). There's nothing in this driver that >> suggests using the more fine-grained interfaces was intentional so >> switch to using the high-level helper. >> >> Signed-off-by: Bartosz Golaszewski <[email protected]> >> --- >> drivers/platform/surface/surface_gpe.c | 36 >> +++++++++++----------------------- >> 1 file changed, 11 insertions(+), 25 deletions(-) >> >> diff --git a/drivers/platform/surface/surface_gpe.c >> b/drivers/platform/surface/surface_gpe.c >> index >> b359413903b13c4f8e8b284ef7ae6f6db3f47d72..b8bb47b0d91f036ee5073d21534f8f26a4d5ed15 >> 100644 >> --- a/drivers/platform/surface/surface_gpe.c >> +++ b/drivers/platform/surface/surface_gpe.c >> @@ -290,9 +290,9 @@ static struct platform_device *surface_gpe_device; >> >> static int __init surface_gpe_init(void) >> { >> + struct platform_device_info pdevinfo; >> const struct dmi_system_id *match; >> struct platform_device *pdev; >> - struct fwnode_handle *fwnode; >> int status; >> >> match = dmi_first_match(dmi_lid_device_table); >> @@ -305,34 +305,20 @@ static int __init surface_gpe_init(void) >> if (status) >> return status; >> >> - fwnode = fwnode_create_software_node(match->driver_data, NULL); >> - if (IS_ERR(fwnode)) { >> - status = PTR_ERR(fwnode); >> - goto err_node; >> - } >> - >> - pdev = platform_device_alloc("surface_gpe", PLATFORM_DEVID_NONE); >> - if (!pdev) { >> - status = -ENOMEM; >> - goto err_alloc; >> + pdevinfo = (struct platform_device_info){ >> + .name = "surface_gpe", >> + .id = PLATFORM_DEVID_NONE, >> + .properties = match->driver_data, >> + }; >> + >> + pdev = platform_device_register_full(&pdevinfo); >> + if (IS_ERR(pdev)) { >> + platform_driver_unregister(&surface_gpe_driver); >> + return PTR_ERR(pdev); >> } >> >> - pdev->dev.fwnode = fwnode; >> - >> - status = platform_device_add(pdev); >> - if (status) >> - goto err_add; >> - >> surface_gpe_device = pdev; >> return 0; >> - >> -err_add: >> - platform_device_put(pdev); >> -err_alloc: >> - fwnode_remove_software_node(fwnode); >> -err_node: >> - platform_driver_unregister(&surface_gpe_driver); >> - return status; >> } >> module_init(surface_gpe_init); > > Acked-by: Ilpo Järvinen <[email protected]> >
Hi! Thanks but FYI: I will replace this series with a different approach once the rework of node assignment for platform devices lands upstream. Bart

