* [PATCH v1 0/2] platform/x86: eeepc-laptop: Bind to a platform device instead of an ACPI one
@ 2026-02-28 15:21 Rafael J. Wysocki
2026-02-28 15:22 ` [PATCH v1 1/2] platform/x86: eeepc-laptop: Register ACPI notify handler directly Rafael J. Wysocki
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2026-02-28 15:21 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86,
Corentin Chary, Luke D. Jones, Denis Benato
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 eeepc-laptop
driver.
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] 6+ messages in thread* [PATCH v1 1/2] platform/x86: eeepc-laptop: Register ACPI notify handler directly 2026-02-28 15:21 [PATCH v1 0/2] platform/x86: eeepc-laptop: Bind to a platform device instead of an ACPI one Rafael J. Wysocki @ 2026-02-28 15:22 ` Rafael J. Wysocki 2026-02-28 17:03 ` Denis Benato 2026-02-28 15:22 ` [PATCH v1 2/2] platform/x86: eeepc-laptop: Convert ACPI driver to a platform one Rafael J. Wysocki 2026-03-09 14:58 ` [PATCH v1 0/2] platform/x86: eeepc-laptop: Bind to a platform device instead of an ACPI one Ilpo Järvinen 2 siblings, 1 reply; 6+ messages in thread From: Rafael J. Wysocki @ 2026-02-28 15:22 UTC (permalink / raw) To: Ilpo Järvinen Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Corentin Chary, Luke D. Jones, Denis Benato 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/eeepc-laptop.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 974f55e0b36f..626a99a71fce 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -1204,9 +1204,10 @@ static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) pr_info("Unknown key %x pressed\n", event); } -static void eeepc_acpi_notify(struct acpi_device *device, u32 event) +static void eeepc_acpi_notify(acpi_handle handle, u32 event, void *data) { - struct eeepc_laptop *eeepc = acpi_driver_data(device); + struct eeepc_laptop *eeepc = data; + struct acpi_device *device = eeepc->device; int old_brightness, new_brightness; u16 count; @@ -1422,9 +1423,16 @@ static int eeepc_acpi_add(struct acpi_device *device) if (result) goto fail_rfkill; + result = acpi_dev_install_notify_handler(device, ACPI_ALL_NOTIFY, + eeepc_acpi_notify, eeepc); + if (result) + goto fail_acpi_notifier; + eeepc_device_present = true; return 0; +fail_acpi_notifier: + eeepc_rfkill_exit(eeepc); fail_rfkill: eeepc_led_exit(eeepc); fail_led: @@ -1444,6 +1452,7 @@ static void eeepc_acpi_remove(struct acpi_device *device) { struct eeepc_laptop *eeepc = acpi_driver_data(device); + acpi_dev_remove_notify_handler(device, ACPI_ALL_NOTIFY, eeepc_acpi_notify); eeepc_backlight_exit(eeepc); eeepc_rfkill_exit(eeepc); eeepc_input_exit(eeepc); @@ -1464,11 +1473,9 @@ static struct acpi_driver eeepc_acpi_driver = { .name = EEEPC_LAPTOP_NAME, .class = EEEPC_ACPI_CLASS, .ids = eeepc_device_ids, - .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, .ops = { .add = eeepc_acpi_add, .remove = eeepc_acpi_remove, - .notify = eeepc_acpi_notify, }, }; -- 2.51.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] platform/x86: eeepc-laptop: Register ACPI notify handler directly 2026-02-28 15:22 ` [PATCH v1 1/2] platform/x86: eeepc-laptop: Register ACPI notify handler directly Rafael J. Wysocki @ 2026-02-28 17:03 ` Denis Benato 0 siblings, 0 replies; 6+ messages in thread From: Denis Benato @ 2026-02-28 17:03 UTC (permalink / raw) To: Rafael J. Wysocki, Ilpo Järvinen Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Corentin Chary, Luke D. Jones On 2/28/26 16:22, Rafael J. Wysocki wrote: > 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. Reviewed-by: Denis Benato <denis.benato@linux.dev> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- > drivers/platform/x86/eeepc-laptop.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c > index 974f55e0b36f..626a99a71fce 100644 > --- a/drivers/platform/x86/eeepc-laptop.c > +++ b/drivers/platform/x86/eeepc-laptop.c > @@ -1204,9 +1204,10 @@ static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) > pr_info("Unknown key %x pressed\n", event); > } > > -static void eeepc_acpi_notify(struct acpi_device *device, u32 event) > +static void eeepc_acpi_notify(acpi_handle handle, u32 event, void *data) > { > - struct eeepc_laptop *eeepc = acpi_driver_data(device); > + struct eeepc_laptop *eeepc = data; > + struct acpi_device *device = eeepc->device; > int old_brightness, new_brightness; > u16 count; > > @@ -1422,9 +1423,16 @@ static int eeepc_acpi_add(struct acpi_device *device) > if (result) > goto fail_rfkill; > > + result = acpi_dev_install_notify_handler(device, ACPI_ALL_NOTIFY, > + eeepc_acpi_notify, eeepc); > + if (result) > + goto fail_acpi_notifier; > + > eeepc_device_present = true; > return 0; > > +fail_acpi_notifier: > + eeepc_rfkill_exit(eeepc); > fail_rfkill: > eeepc_led_exit(eeepc); > fail_led: > @@ -1444,6 +1452,7 @@ static void eeepc_acpi_remove(struct acpi_device *device) > { > struct eeepc_laptop *eeepc = acpi_driver_data(device); > > + acpi_dev_remove_notify_handler(device, ACPI_ALL_NOTIFY, eeepc_acpi_notify); > eeepc_backlight_exit(eeepc); > eeepc_rfkill_exit(eeepc); > eeepc_input_exit(eeepc); > @@ -1464,11 +1473,9 @@ static struct acpi_driver eeepc_acpi_driver = { > .name = EEEPC_LAPTOP_NAME, > .class = EEEPC_ACPI_CLASS, > .ids = eeepc_device_ids, > - .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, > .ops = { > .add = eeepc_acpi_add, > .remove = eeepc_acpi_remove, > - .notify = eeepc_acpi_notify, > }, > }; > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 2/2] platform/x86: eeepc-laptop: Convert ACPI driver to a platform one 2026-02-28 15:21 [PATCH v1 0/2] platform/x86: eeepc-laptop: Bind to a platform device instead of an ACPI one Rafael J. Wysocki 2026-02-28 15:22 ` [PATCH v1 1/2] platform/x86: eeepc-laptop: Register ACPI notify handler directly Rafael J. Wysocki @ 2026-02-28 15:22 ` Rafael J. Wysocki 2026-02-28 17:04 ` Denis Benato 2026-03-09 14:58 ` [PATCH v1 0/2] platform/x86: eeepc-laptop: Bind to a platform device instead of an ACPI one Ilpo Järvinen 2 siblings, 1 reply; 6+ messages in thread From: Rafael J. Wysocki @ 2026-02-28 15:22 UTC (permalink / raw) To: Ilpo Järvinen Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Corentin Chary, Luke D. Jones, Denis Benato 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 EEEPC laptop 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/eeepc-laptop.c | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 626a99a71fce..02a71095920e 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -1361,8 +1361,9 @@ static void eeepc_enable_camera(struct eeepc_laptop *eeepc) static bool eeepc_device_present; -static int eeepc_acpi_add(struct acpi_device *device) +static int eeepc_acpi_probe(struct platform_device *pdev) { + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); struct eeepc_laptop *eeepc; int result; @@ -1373,9 +1374,10 @@ static int eeepc_acpi_add(struct acpi_device *device) eeepc->handle = device->handle; strscpy(acpi_device_name(device), EEEPC_ACPI_DEVICE_NAME); strscpy(acpi_device_class(device), EEEPC_ACPI_CLASS); - device->driver_data = eeepc; eeepc->device = device; + platform_set_drvdata(pdev, eeepc); + eeepc->hotplug_disabled = hotplug_disabled; eeepc_dmi_check(eeepc); @@ -1448,11 +1450,12 @@ static int eeepc_acpi_add(struct acpi_device *device) return result; } -static void eeepc_acpi_remove(struct acpi_device *device) +static void eeepc_acpi_remove(struct platform_device *pdev) { - struct eeepc_laptop *eeepc = acpi_driver_data(device); + struct eeepc_laptop *eeepc = platform_get_drvdata(pdev); - acpi_dev_remove_notify_handler(device, ACPI_ALL_NOTIFY, eeepc_acpi_notify); + acpi_dev_remove_notify_handler(ACPI_COMPANION(&pdev->dev), + ACPI_ALL_NOTIFY, eeepc_acpi_notify); eeepc_backlight_exit(eeepc); eeepc_rfkill_exit(eeepc); eeepc_input_exit(eeepc); @@ -1469,13 +1472,12 @@ static const struct acpi_device_id eeepc_device_ids[] = { }; MODULE_DEVICE_TABLE(acpi, eeepc_device_ids); -static struct acpi_driver eeepc_acpi_driver = { - .name = EEEPC_LAPTOP_NAME, - .class = EEEPC_ACPI_CLASS, - .ids = eeepc_device_ids, - .ops = { - .add = eeepc_acpi_add, - .remove = eeepc_acpi_remove, +static struct platform_driver eeepc_acpi_driver = { + .probe = eeepc_acpi_probe, + .remove = eeepc_acpi_remove, + .driver = { + .name = EEEPC_LAPTOP_NAME, + .acpi_match_table = eeepc_device_ids, }, }; @@ -1488,7 +1490,7 @@ static int __init eeepc_laptop_init(void) if (result < 0) return result; - result = acpi_bus_register_driver(&eeepc_acpi_driver); + result = platform_driver_register(&eeepc_acpi_driver); if (result < 0) goto fail_acpi_driver; @@ -1500,7 +1502,7 @@ static int __init eeepc_laptop_init(void) return 0; fail_no_device: - acpi_bus_unregister_driver(&eeepc_acpi_driver); + platform_driver_unregister(&eeepc_acpi_driver); fail_acpi_driver: platform_driver_unregister(&platform_driver); return result; @@ -1508,7 +1510,7 @@ static int __init eeepc_laptop_init(void) static void __exit eeepc_laptop_exit(void) { - acpi_bus_unregister_driver(&eeepc_acpi_driver); + platform_driver_unregister(&eeepc_acpi_driver); platform_driver_unregister(&platform_driver); } -- 2.51.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 2/2] platform/x86: eeepc-laptop: Convert ACPI driver to a platform one 2026-02-28 15:22 ` [PATCH v1 2/2] platform/x86: eeepc-laptop: Convert ACPI driver to a platform one Rafael J. Wysocki @ 2026-02-28 17:04 ` Denis Benato 0 siblings, 0 replies; 6+ messages in thread From: Denis Benato @ 2026-02-28 17:04 UTC (permalink / raw) To: Rafael J. Wysocki, Ilpo Järvinen Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Corentin Chary, Luke D. Jones On 2/28/26 16:22, Rafael J. Wysocki wrote: > 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 EEEPC laptop 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> Reviewed-by: Denis Benato <denis.benato@linux.dev> > --- > drivers/platform/x86/eeepc-laptop.c | 32 +++++++++++++++-------------- > 1 file changed, 17 insertions(+), 15 deletions(-) > > diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c > index 626a99a71fce..02a71095920e 100644 > --- a/drivers/platform/x86/eeepc-laptop.c > +++ b/drivers/platform/x86/eeepc-laptop.c > @@ -1361,8 +1361,9 @@ static void eeepc_enable_camera(struct eeepc_laptop *eeepc) > > static bool eeepc_device_present; > > -static int eeepc_acpi_add(struct acpi_device *device) > +static int eeepc_acpi_probe(struct platform_device *pdev) > { > + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); > struct eeepc_laptop *eeepc; > int result; > > @@ -1373,9 +1374,10 @@ static int eeepc_acpi_add(struct acpi_device *device) > eeepc->handle = device->handle; > strscpy(acpi_device_name(device), EEEPC_ACPI_DEVICE_NAME); > strscpy(acpi_device_class(device), EEEPC_ACPI_CLASS); > - device->driver_data = eeepc; > eeepc->device = device; > > + platform_set_drvdata(pdev, eeepc); > + > eeepc->hotplug_disabled = hotplug_disabled; > > eeepc_dmi_check(eeepc); > @@ -1448,11 +1450,12 @@ static int eeepc_acpi_add(struct acpi_device *device) > return result; > } > > -static void eeepc_acpi_remove(struct acpi_device *device) > +static void eeepc_acpi_remove(struct platform_device *pdev) > { > - struct eeepc_laptop *eeepc = acpi_driver_data(device); > + struct eeepc_laptop *eeepc = platform_get_drvdata(pdev); > > - acpi_dev_remove_notify_handler(device, ACPI_ALL_NOTIFY, eeepc_acpi_notify); > + acpi_dev_remove_notify_handler(ACPI_COMPANION(&pdev->dev), > + ACPI_ALL_NOTIFY, eeepc_acpi_notify); > eeepc_backlight_exit(eeepc); > eeepc_rfkill_exit(eeepc); > eeepc_input_exit(eeepc); > @@ -1469,13 +1472,12 @@ static const struct acpi_device_id eeepc_device_ids[] = { > }; > MODULE_DEVICE_TABLE(acpi, eeepc_device_ids); > > -static struct acpi_driver eeepc_acpi_driver = { > - .name = EEEPC_LAPTOP_NAME, > - .class = EEEPC_ACPI_CLASS, > - .ids = eeepc_device_ids, > - .ops = { > - .add = eeepc_acpi_add, > - .remove = eeepc_acpi_remove, > +static struct platform_driver eeepc_acpi_driver = { > + .probe = eeepc_acpi_probe, > + .remove = eeepc_acpi_remove, > + .driver = { > + .name = EEEPC_LAPTOP_NAME, > + .acpi_match_table = eeepc_device_ids, > }, > }; > > @@ -1488,7 +1490,7 @@ static int __init eeepc_laptop_init(void) > if (result < 0) > return result; > > - result = acpi_bus_register_driver(&eeepc_acpi_driver); > + result = platform_driver_register(&eeepc_acpi_driver); > if (result < 0) > goto fail_acpi_driver; > > @@ -1500,7 +1502,7 @@ static int __init eeepc_laptop_init(void) > return 0; > > fail_no_device: > - acpi_bus_unregister_driver(&eeepc_acpi_driver); > + platform_driver_unregister(&eeepc_acpi_driver); > fail_acpi_driver: > platform_driver_unregister(&platform_driver); > return result; > @@ -1508,7 +1510,7 @@ static int __init eeepc_laptop_init(void) > > static void __exit eeepc_laptop_exit(void) > { > - acpi_bus_unregister_driver(&eeepc_acpi_driver); > + platform_driver_unregister(&eeepc_acpi_driver); > platform_driver_unregister(&platform_driver); > } > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 0/2] platform/x86: eeepc-laptop: Bind to a platform device instead of an ACPI one 2026-02-28 15:21 [PATCH v1 0/2] platform/x86: eeepc-laptop: Bind to a platform device instead of an ACPI one Rafael J. Wysocki 2026-02-28 15:22 ` [PATCH v1 1/2] platform/x86: eeepc-laptop: Register ACPI notify handler directly Rafael J. Wysocki 2026-02-28 15:22 ` [PATCH v1 2/2] platform/x86: eeepc-laptop: Convert ACPI driver to a platform one Rafael J. Wysocki @ 2026-03-09 14:58 ` Ilpo Järvinen 2 siblings, 0 replies; 6+ messages in thread From: Ilpo Järvinen @ 2026-03-09 14:58 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Hans de Goede, LKML, Linux ACPI, platform-driver-x86, Corentin Chary, Luke D. Jones, Denis Benato On Sat, 28 Feb 2026 16:21:17 +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: eeepc-laptop: Register ACPI notify handler directly commit: 5eea33b4d301e279abe49cdbd28f8be24e8932a1 [2/2] platform/x86: eeepc-laptop: Convert ACPI driver to a platform one commit: 079b59fd2d79e4f492cba7013c5f60787d573fc8 -- i. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-09 14:58 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-02-28 15:21 [PATCH v1 0/2] platform/x86: eeepc-laptop: Bind to a platform device instead of an ACPI one Rafael J. Wysocki 2026-02-28 15:22 ` [PATCH v1 1/2] platform/x86: eeepc-laptop: Register ACPI notify handler directly Rafael J. Wysocki 2026-02-28 17:03 ` Denis Benato 2026-02-28 15:22 ` [PATCH v1 2/2] platform/x86: eeepc-laptop: Convert ACPI driver to a platform one Rafael J. Wysocki 2026-02-28 17:04 ` Denis Benato 2026-03-09 14:58 ` [PATCH v1 0/2] platform/x86: eeepc-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