* [PATCH v1 0/2] platform/x86: wireless-hotkey: Bind to a platform device instead of an ACPI one
@ 2026-03-12 14:37 Rafael J. Wysocki
2026-03-12 14:38 ` [PATCH v1 1/2] platform/x86: wireless-hotkey: Register ACPI notify handler directly Rafael J. Wysocki
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-03-12 14:37 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86
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 airplane
mode button driver for AMD, HP and Xiaomi laptops.
Patch [1/2] updates the driver to install an ACPI notify handler by itself
instead of using the .notify() callback from struct acpi_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: wireless-hotkey: Register ACPI notify handler directly
2026-03-12 14:37 [PATCH v1 0/2] platform/x86: wireless-hotkey: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
@ 2026-03-12 14:38 ` Rafael J. Wysocki
2026-03-12 14:40 ` [PATCH v1 2/2] platform/x86: wireless-hotkey: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-17 18:08 ` [PATCH v1 0/2] platform/x86: wireless-hotkey: 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 14:38 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
To facilitate subsequent conversion of the driver to a platform one,
make it install an ACPI notify handler directly instead of using
a .notify() callback in struct acpi_driver.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/platform/x86/wireless-hotkey.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/wireless-hotkey.c b/drivers/platform/x86/wireless-hotkey.c
index e5083c0e1515..a0ae757a277e 100644
--- a/drivers/platform/x86/wireless-hotkey.c
+++ b/drivers/platform/x86/wireless-hotkey.c
@@ -71,9 +71,9 @@ static void wireless_input_destroy(struct acpi_device *device)
kfree(button);
}
-static void wl_notify(struct acpi_device *acpi_dev, u32 event)
+static void wl_notify(acpi_handle handle, u32 event, void *data)
{
- struct wl_button *button = acpi_driver_data(acpi_dev);
+ struct wl_button *button = data;
if (event != 0x80) {
pr_info("Received unknown event (0x%x)\n", event);
@@ -101,6 +101,13 @@ static int wl_add(struct acpi_device *device)
if (err) {
pr_err("Failed to setup wireless hotkeys\n");
kfree(button);
+ return err;
+ }
+ err = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
+ wl_notify, button);
+ if (err) {
+ pr_err("Failed to install ACPI notify handler\n");
+ wireless_input_destroy(device);
}
return err;
@@ -108,6 +115,7 @@ static int wl_add(struct acpi_device *device)
static void wl_remove(struct acpi_device *device)
{
+ acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY, wl_notify);
wireless_input_destroy(device);
}
@@ -117,7 +125,6 @@ static struct acpi_driver wl_driver = {
.ops = {
.add = wl_add,
.remove = wl_remove,
- .notify = wl_notify,
},
};
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] platform/x86: wireless-hotkey: Convert ACPI driver to a platform one
2026-03-12 14:37 [PATCH v1 0/2] platform/x86: wireless-hotkey: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
2026-03-12 14:38 ` [PATCH v1 1/2] platform/x86: wireless-hotkey: Register ACPI notify handler directly Rafael J. Wysocki
@ 2026-03-12 14:40 ` Rafael J. Wysocki
2026-03-17 18:08 ` [PATCH v1 0/2] platform/x86: wireless-hotkey: 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 14:40 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86
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 airplane mode button for AMD, HP and
Xiaomi laptops 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/wireless-hotkey.c | 44 ++++++++++++++------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/drivers/platform/x86/wireless-hotkey.c b/drivers/platform/x86/wireless-hotkey.c
index a0ae757a277e..f680d8ff8e87 100644
--- a/drivers/platform/x86/wireless-hotkey.c
+++ b/drivers/platform/x86/wireless-hotkey.c
@@ -35,16 +35,17 @@ static const struct acpi_device_id wl_ids[] = {
{"", 0},
};
-static int wireless_input_setup(struct acpi_device *device)
+static int wireless_input_setup(struct device *dev)
{
- struct wl_button *button = acpi_driver_data(device);
+ struct wl_button *button = dev_get_drvdata(dev);
int err;
button->input_dev = input_allocate_device();
if (!button->input_dev)
return -ENOMEM;
- snprintf(button->phys, sizeof(button->phys), "%s/input0", acpi_device_hid(device));
+ snprintf(button->phys, sizeof(button->phys), "%s/input0",
+ acpi_device_hid(ACPI_COMPANION(dev)));
button->input_dev->name = "Wireless hotkeys";
button->input_dev->phys = button->phys;
@@ -63,9 +64,9 @@ static int wireless_input_setup(struct acpi_device *device)
return err;
}
-static void wireless_input_destroy(struct acpi_device *device)
+static void wireless_input_destroy(struct device *dev)
{
- struct wl_button *button = acpi_driver_data(device);
+ struct wl_button *button = dev_get_drvdata(dev);
input_unregister_device(button->input_dev);
kfree(button);
@@ -86,7 +87,7 @@ static void wl_notify(acpi_handle handle, u32 event, void *data)
input_sync(button->input_dev);
}
-static int wl_add(struct acpi_device *device)
+static int wl_probe(struct platform_device *pdev)
{
struct wl_button *button;
int err;
@@ -95,37 +96,38 @@ static int wl_add(struct acpi_device *device)
if (!button)
return -ENOMEM;
- device->driver_data = button;
+ platform_set_drvdata(pdev, button);
- err = wireless_input_setup(device);
+ err = wireless_input_setup(&pdev->dev);
if (err) {
pr_err("Failed to setup wireless hotkeys\n");
kfree(button);
return err;
}
- err = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
- wl_notify, button);
+ err = acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
+ ACPI_DEVICE_NOTIFY, wl_notify, button);
if (err) {
pr_err("Failed to install ACPI notify handler\n");
- wireless_input_destroy(device);
+ wireless_input_destroy(&pdev->dev);
}
return err;
}
-static void wl_remove(struct acpi_device *device)
+static void wl_remove(struct platform_device *pdev)
{
- acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY, wl_notify);
- wireless_input_destroy(device);
+ acpi_dev_remove_notify_handler(ACPI_COMPANION(&pdev->dev),
+ ACPI_DEVICE_NOTIFY, wl_notify);
+ wireless_input_destroy(&pdev->dev);
}
-static struct acpi_driver wl_driver = {
- .name = "wireless-hotkey",
- .ids = wl_ids,
- .ops = {
- .add = wl_add,
- .remove = wl_remove,
+static struct platform_driver wl_driver = {
+ .probe = wl_probe,
+ .remove = wl_remove,
+ .driver = {
+ .name = "wireless-hotkey",
+ .acpi_match_table = wl_ids,
},
};
-module_acpi_driver(wl_driver);
+module_platform_driver(wl_driver);
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 0/2] platform/x86: wireless-hotkey: Bind to a platform device instead of an ACPI one
2026-03-12 14:37 [PATCH v1 0/2] platform/x86: wireless-hotkey: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
2026-03-12 14:38 ` [PATCH v1 1/2] platform/x86: wireless-hotkey: Register ACPI notify handler directly Rafael J. Wysocki
2026-03-12 14:40 ` [PATCH v1 2/2] platform/x86: wireless-hotkey: 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
On Thu, 12 Mar 2026 15:37:45 +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: wireless-hotkey: Register ACPI notify handler directly
commit: cfc897f6d3f7e9e284d498cd9fc4c68488166f48
[2/2] platform/x86: wireless-hotkey: Convert ACPI driver to a platform one
commit: 8507277ef1326d6854a6445354cd43e93e2b95fa
--
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 14:37 [PATCH v1 0/2] platform/x86: wireless-hotkey: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
2026-03-12 14:38 ` [PATCH v1 1/2] platform/x86: wireless-hotkey: Register ACPI notify handler directly Rafael J. Wysocki
2026-03-12 14:40 ` [PATCH v1 2/2] platform/x86: wireless-hotkey: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-17 18:08 ` [PATCH v1 0/2] platform/x86: wireless-hotkey: 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®