From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: "Maximilian Luz" <luzmaximilian@gmail.com>,
"Hans de Goede" <hansg@kernel.org>,
"Matthew Brost" <matthew.brost@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
brgl@kernel.org, platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
driver-core@lists.linux.dev
Subject: Re: [PATCH v7 1/4] platform/surface: gpe: use platform_device_register_full()
Date: Tue, 21 Jul 2026 19:19:42 +0300 (EEST) [thread overview]
Message-ID: <51d2d692-ba40-3035-fac2-a9e8e98e6d99@linux.intel.com> (raw)
In-Reply-To: <20260713-swnode-remove-on-dev-unreg-v7-1-6d6bc448427a@oss.qualcomm.com>
[-- Attachment #1: Type: text/plain, Size: 2919 bytes --]
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 <bartosz.golaszewski@oss.qualcomm.com>
> ---
> 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 <ilpo.jarvinen@linux.intel.com>
Thanks for doing these.
> + platform_driver_unregister(&surface_gpe_driver);
> + return PTR_ERR(pdev);
> }
--
i.
>
> - platform_device_set_fwnode(pdev, 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);
>
> static void __exit surface_gpe_exit(void)
> {
> - struct fwnode_handle *fwnode = surface_gpe_device->dev.fwnode;
> -
> platform_device_unregister(surface_gpe_device);
> platform_driver_unregister(&surface_gpe_driver);
> - fwnode_remove_software_node(fwnode);
> }
> module_exit(surface_gpe_exit);
next prev parent reply other threads:[~2026-07-21 16:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 15:11 [PATCH v7 0/4] driver core: unify the release path for dynamically allocated platform devices Bartosz Golaszewski
2026-07-13 15:11 ` [PATCH v7 1/4] platform/surface: gpe: use platform_device_register_full() Bartosz Golaszewski
2026-07-21 16:19 ` Ilpo Järvinen [this message]
2026-07-22 9:47 ` Bartosz Golaszewski
2026-07-13 15:11 ` [PATCH v7 2/4] drm/xe/i2c: use device_create_managed_software_node() Bartosz Golaszewski
2026-07-13 15:37 ` Rodrigo Vivi
2026-07-14 9:40 ` Heikki Krogerus
2026-07-13 15:11 ` [PATCH v7 3/4] driver core: platform: unify release path Bartosz Golaszewski
2026-07-13 18:45 ` Danilo Krummrich
2026-07-15 13:52 ` Bartosz Golaszewski
2026-07-15 15:06 ` Bartosz Golaszewski
2026-07-15 15:19 ` Danilo Krummrich
2026-07-15 15:25 ` Bartosz Golaszewski
2026-07-15 15:54 ` Danilo Krummrich
2026-07-15 15:11 ` Danilo Krummrich
2026-07-13 15:12 ` [PATCH v7 4/4] driver core: platform: tests: add test cases for correct swnode removal Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51d2d692-ba40-3035-fac2-a9e8e98e6d99@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=airlied@gmail.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luzmaximilian@gmail.com \
--cc=matthew.brost@intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox