From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Brendan Higgins" <brendan.higgins@linux.dev>,
"David Gow" <david@davidgow.net>,
"Rae Moar" <raemoar63@gmail.com>,
"Andy Shevchenko" <andy@kernel.org>,
"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>,
brgl@kernel.org, driver-core@lists.linux.dev,
LKML <linux-kernel@vger.kernel.org>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
platform-driver-x86@vger.kernel.org,
intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 2/6] platform/surface: gpe: use platform_device_register_full()
Date: Thu, 28 May 2026 15:35:50 +0300 (EEST) [thread overview]
Message-ID: <9a0d0e01-adf8-e111-49a0-580239265dbf@linux.intel.com> (raw)
In-Reply-To: <20260513-swnode-remove-on-dev-unreg-v6-2-f9c58939df27@oss.qualcomm.com>
[-- Attachment #1: Type: text/plain, Size: 2462 bytes --]
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 <bartosz.golaszewski@oss.qualcomm.com>
> ---
> 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 <ilpo.jarvinen@linux.intel.com>
--
i.
next prev parent reply other threads:[~2026-05-28 12:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 15:04 [PATCH v6 0/6] driver core: remove software node from platform devices on device release Bartosz Golaszewski
2026-05-13 15:04 ` [PATCH v6 1/6] driver core: platform: remove software node on release() Bartosz Golaszewski
2026-05-13 15:04 ` [PATCH v6 2/6] platform/surface: gpe: use platform_device_register_full() Bartosz Golaszewski
2026-05-28 12:35 ` Ilpo Järvinen [this message]
2026-05-28 13:02 ` Bartosz Golaszewski
2026-05-13 15:04 ` [PATCH v6 3/6] drm/xe/i2c: use device_create_managed_software_node() Bartosz Golaszewski
2026-05-13 15:04 ` [PATCH v6 4/6] driver core: platform: unify release path Bartosz Golaszewski
2026-05-13 15:04 ` [PATCH v6 5/6] kunit: provide kunit_software_node_register() Bartosz Golaszewski
2026-05-13 15:04 ` [PATCH v6 6/6] driver core: platform: tests: add test cases for correct swnode removal Bartosz Golaszewski
2026-05-14 0:24 ` (subset) [PATCH v6 0/6] driver core: remove software node from platform devices on device release Danilo Krummrich
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=9a0d0e01-adf8-e111-49a0-580239265dbf@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=airlied@gmail.com \
--cc=andy@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brendan.higgins@linux.dev \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=david@davidgow.net \
--cc=dmitry.torokhov@gmail.com \
--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=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luzmaximilian@gmail.com \
--cc=matthew.brost@intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=raemoar63@gmail.com \
--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