Re: [PATCH v7 1/4] platform/surface: gpe: use platform_device_register_full()

Bartosz Golaszewski <[email protected]>
Newsgroups org.kernel.vger.platform-driver-x86,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.freedesktop.lists.intel-xe,org.kernel.vger.linux-kernel
Message-ID <CAMRc=McoW72iX1GKWJAeVDBV4ft_sqDtcOwhF8XSWyC8agQhWA@mail.gmail.com>
On Tue, 21 Jul 2026 18:19:42 +0200, "Ilpo Järvinen"
<[email protected]> said:
> On Mon, 13 Jul 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 | 39 ++++++++++------------------------
>>  1 file changed, 11 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/platform/surface/surface_gpe.c b/drivers/platform/surface/surface_gpe.c
>> index 40896a8544b0a4da4261ea881b1eaed62d93b32b..4ca7ad76f3b9d2b6c455a5d5b37f23a85eb69c69 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,44 +305,27 @@ 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)) {
>
> Hi,
>
> Please add an include for this and PTR_ERR().
>
> With the missing include fixed,
>
> Acked-by: Ilpo Järvinen <[email protected]>
>
> Thanks for doing these.
>

Danilo already queued it so I'll send a follow-up once it's in next.

Bartosz
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.