mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one
@ 2026-03-12 11:13 Rafael J. Wysocki
  2026-03-12 11:14 ` [PATCH v1 1/2] platform/x86: lg-laptop: Drop debug-only ACPI notify handler Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-03-12 11:13 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Matan Ziv-Av

Hi All,

This series is part of a larger effort to switch over all drivers using
the struct acpi_driver interface to the more common struct platform_driver
interface and eliminate the former.  The background is explained in
Documentation/driver-api/acpi/acpi-drivers.rst and in the changelog of
the patch that introduced the above document:

https://lore.kernel.org/all/2396510.ElGaqSPkdT@rafael.j.wysocki/

The bottom line is that the kernel would be better off without struct
acpi_driver and so it is better to get rid of it.

This series carries out driver conversion of the platform x86 LG Gram ACPI
features and hotkeys driver.

Patch [1/2] drops a debug-only .notify() callback from the driver, which is
requisite for the driver conversion.

Patch [2/2] converts the driver to using struct platform_driver for device
binding.

Thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 1/2] platform/x86: lg-laptop: Drop debug-only ACPI notify handler
  2026-03-12 11:13 [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
@ 2026-03-12 11:14 ` Rafael J. Wysocki
  2026-03-12 11:14 ` [PATCH v1 2/2] platform/x86: lg-laptop: Convert ACPI driver to a platform one Rafael J. Wysocki
  2026-03-17 18:08 ` [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one Ilpo Järvinen
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-03-12 11:14 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Matan Ziv-Av

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

To facilitate subsequent conversion of the driver to using struct
platform_driver instead of struct acpi_driver, drop the debug-only
notify handler method from the driver.

No intentional functional impact beyond debug.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/lg-laptop.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
index 61ef7a218a80..7122d96abf86 100644
--- a/drivers/platform/x86/lg-laptop.c
+++ b/drivers/platform/x86/lg-laptop.c
@@ -271,11 +271,6 @@ static void wmi_input_setup(void)
 	}
 }
 
-static void acpi_notify(struct acpi_device *device, u32 event)
-{
-	acpi_handle_debug(device->handle, "notify: %d\n", event);
-}
-
 static ssize_t fan_mode_store(struct device *dev,
 			      struct device_attribute *attr,
 			      const char *buffer, size_t count)
@@ -906,7 +901,6 @@ static struct acpi_driver acpi_driver = {
 	.ops = {
 		.add = acpi_add,
 		.remove = acpi_remove,
-		.notify = acpi_notify,
 		},
 };
 
-- 
2.51.0





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 2/2] platform/x86: lg-laptop: Convert ACPI driver to a platform one
  2026-03-12 11:13 [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
  2026-03-12 11:14 ` [PATCH v1 1/2] platform/x86: lg-laptop: Drop debug-only ACPI notify handler Rafael J. Wysocki
@ 2026-03-12 11:14 ` Rafael J. Wysocki
  2026-03-17 18:08 ` [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one Ilpo Järvinen
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-03-12 11:14 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Matan Ziv-Av

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

In all cases in which a struct acpi_driver is used for binding a driver
to an ACPI device object, a corresponding platform device is created by
the ACPI core and that device is regarded as a proper representation of
underlying hardware.  Accordingly, a struct platform_driver should be
used by driver code to bind to that device.  There are multiple reasons
why drivers should not bind directly to ACPI device objects [1].

Overall, it is better to bind drivers to platform devices than to their
ACPI companions, so convert the LG Gram ACPI features and hotkeys driver
from an ACPI driver to a platform one.

While this is not expected to alter functionality, it changes sysfs
layout and so it will be visible to user space.

Link: https://lore.kernel.org/all/2396510.ElGaqSPkdT@rafael.j.wysocki/ [1]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/lg-laptop.c | 45 +++++++++-----------------------
 1 file changed, 13 insertions(+), 32 deletions(-)

diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
index 7122d96abf86..9681412d694b 100644
--- a/drivers/platform/x86/lg-laptop.c
+++ b/drivers/platform/x86/lg-laptop.c
@@ -759,8 +759,9 @@ static void lg_laptop_remove_address_space_handler(void *data)
 					  &lg_laptop_address_space_handler);
 }
 
-static int acpi_add(struct acpi_device *device)
+static int acpi_probe(struct platform_device *pdev)
 {
+	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
 	struct platform_device_info pdev_info = {
 		.fwnode = acpi_fwnode_handle(device),
 		.name = PLATFORM_NAME,
@@ -776,11 +777,11 @@ static int acpi_add(struct acpi_device *device)
 
 	status = acpi_install_address_space_handler(device->handle, LG_ADDRESS_SPACE_ID,
 						    &lg_laptop_address_space_handler,
-						    NULL, &device->dev);
+						    NULL, &pdev->dev);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 
-	ret = devm_add_action_or_reset(&device->dev, lg_laptop_remove_address_space_handler,
+	ret = devm_add_action_or_reset(&pdev->dev, lg_laptop_remove_address_space_handler,
 				       device);
 	if (ret < 0)
 		return ret;
@@ -874,7 +875,7 @@ static int acpi_add(struct acpi_device *device)
 	return ret;
 }
 
-static void acpi_remove(struct acpi_device *device)
+static void acpi_remove(struct platform_device *pdev)
 {
 	sysfs_remove_group(&pf_device->dev.kobj, &dev_attribute_group);
 
@@ -894,33 +895,13 @@ static const struct acpi_device_id device_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, device_ids);
 
-static struct acpi_driver acpi_driver = {
-	.name = "LG Gram Laptop Support",
-	.class = "lg-laptop",
-	.ids = device_ids,
-	.ops = {
-		.add = acpi_add,
-		.remove = acpi_remove,
-		},
+static struct platform_driver acpi_driver = {
+	.probe = acpi_probe,
+	.remove = acpi_remove,
+	.driver = {
+		.name = "LG Gram Laptop Support",
+		.acpi_match_table = device_ids,
+	},
 };
 
-static int __init acpi_init(void)
-{
-	int result;
-
-	result = acpi_bus_register_driver(&acpi_driver);
-	if (result < 0) {
-		pr_debug("Error registering driver\n");
-		return -ENODEV;
-	}
-
-	return 0;
-}
-
-static void __exit acpi_exit(void)
-{
-	acpi_bus_unregister_driver(&acpi_driver);
-}
-
-module_init(acpi_init);
-module_exit(acpi_exit);
+module_platform_driver(acpi_driver);
-- 
2.51.0





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one
  2026-03-12 11:13 [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
  2026-03-12 11:14 ` [PATCH v1 1/2] platform/x86: lg-laptop: Drop debug-only ACPI notify handler Rafael J. Wysocki
  2026-03-12 11:14 ` [PATCH v1 2/2] platform/x86: lg-laptop: Convert ACPI driver to a platform one Rafael J. Wysocki
@ 2026-03-17 18:08 ` Ilpo Järvinen
  2 siblings, 0 replies; 4+ messages in thread
From: Ilpo Järvinen @ 2026-03-17 18:08 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Matan Ziv-Av

On Thu, 12 Mar 2026 12:13:05 +0100, Rafael J. Wysocki wrote:

> This series is part of a larger effort to switch over all drivers using
> the struct acpi_driver interface to the more common struct platform_driver
> interface and eliminate the former.  The background is explained in
> Documentation/driver-api/acpi/acpi-drivers.rst and in the changelog of
> the patch that introduced the above document:
> 
> https://lore.kernel.org/all/2396510.ElGaqSPkdT@rafael.j.wysocki/
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/2] platform/x86: lg-laptop: Drop debug-only ACPI notify handler
      commit: c12fe0b2c12195e0d1c56e0f670a6bd792b0567e
[2/2] platform/x86: lg-laptop: Convert ACPI driver to a platform one
      commit: 2d9cb20610f75ca48c1cac064aede90196787507

--
 i.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-17 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-12 11:13 [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
2026-03-12 11:14 ` [PATCH v1 1/2] platform/x86: lg-laptop: Drop debug-only ACPI notify handler Rafael J. Wysocki
2026-03-12 11:14 ` [PATCH v1 2/2] platform/x86: lg-laptop: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-17 18:08 ` [PATCH v1 0/2] platform/x86: lg-laptop: Bind to a platform device instead of an ACPI one Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®