From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Robert Gerlach <khnz@gmx.de>, Hans de Goede <hansg@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>,
platform-driver-x86@vger.kernel.org,
Jonathan Woithe <jwoithe@just42.net>
Subject: [PATCH v2 3/5] platform/x86: fujitsu: Register ACPI notify handlers directly
Date: Mon, 09 Mar 2026 18:07:37 +0100 [thread overview]
Message-ID: <1961003.tdWV9SEqCh@rafael.j.wysocki> (raw)
In-Reply-To: <12863082.O9o76ZdvQC@rafael.j.wysocki>
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, make it install its ACPI
notify handlers directly instead of using struct acpi_driver .notify()
callbacks.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
v1 -> v2: Call fujitsu_laptop_platform_remove() in acpi_fujitsu_laptop_add()
error code path if notify handler registration fails (Ilpo)
---
drivers/platform/x86/fujitsu-laptop.c | 32 ++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 1adce90ae3e6..7816a867a60c 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -502,8 +502,9 @@ static int fujitsu_backlight_register(struct acpi_device *device)
/* Brightness notify */
-static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event)
+static void acpi_fujitsu_bl_notify(acpi_handle handle, u32 event, void *data)
{
+ struct acpi_device *device = data;
struct fujitsu_bl *priv = acpi_driver_data(device);
int oldb, newb;
@@ -558,7 +559,18 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device)
if (ret)
return ret;
- return fujitsu_backlight_register(device);
+ ret = fujitsu_backlight_register(device);
+ if (ret)
+ return ret;
+
+ return acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
+ acpi_fujitsu_bl_notify, device);
+}
+
+static void acpi_fujitsu_bl_remove(struct acpi_device *device)
+{
+ acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
+ acpi_fujitsu_bl_notify);
}
/* ACPI device for hotkey handling */
@@ -941,8 +953,9 @@ static void acpi_fujitsu_laptop_release(struct acpi_device *device)
}
}
-static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event)
+static void acpi_fujitsu_laptop_notify(acpi_handle handle, u32 event, void *data)
{
+ struct acpi_device *device = data;
struct fujitsu_laptop *priv = acpi_driver_data(device);
unsigned long flags;
int scancode, i = 0;
@@ -1056,6 +1069,13 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)
if (ret)
goto err_free_fifo;
+ ret = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
+ acpi_fujitsu_laptop_notify, device);
+ if (ret) {
+ fujitsu_laptop_platform_remove(device);
+ goto err_free_fifo;
+ }
+
ret = fujitsu_battery_charge_control_add(device);
if (ret < 0)
pr_warn("Unable to register battery charge control: %d\n", ret);
@@ -1074,6 +1094,9 @@ static void acpi_fujitsu_laptop_remove(struct acpi_device *device)
fujitsu_battery_charge_control_remove(device);
+ acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
+ acpi_fujitsu_laptop_notify);
+
fujitsu_laptop_platform_remove(device);
kfifo_free(&priv->fifo);
@@ -1092,7 +1115,7 @@ static struct acpi_driver acpi_fujitsu_bl_driver = {
.ids = fujitsu_bl_device_ids,
.ops = {
.add = acpi_fujitsu_bl_add,
- .notify = acpi_fujitsu_bl_notify,
+ .remove = acpi_fujitsu_bl_remove,
},
};
@@ -1108,7 +1131,6 @@ static struct acpi_driver acpi_fujitsu_laptop_driver = {
.ops = {
.add = acpi_fujitsu_laptop_add,
.remove = acpi_fujitsu_laptop_remove,
- .notify = acpi_fujitsu_laptop_notify,
},
};
--
2.51.0
next prev parent reply other threads:[~2026-03-09 17:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 17:03 [PATCH v2 0/5] platform/x86: fujitsu: Bind drivers to platform devices instead of ACPI ones Rafael J. Wysocki
2026-03-09 17:04 ` [PATCH v2 1/5] platform/x86: fujitsu-tablet: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-09 17:05 ` [PATCH v2 2/5] platform/x86: fujitsu: Reorder code to avoid forward declarations Rafael J. Wysocki
2026-03-09 17:07 ` Rafael J. Wysocki [this message]
2026-03-17 15:19 ` [PATCH v2 3/5] platform/x86: fujitsu: Register ACPI notify handlers directly Ilpo Järvinen
2026-03-17 15:52 ` Rafael J. Wysocki
2026-03-17 15:56 ` Ilpo Järvinen
2026-03-09 17:09 ` [PATCH v2 5/5] platform/x86: fujitsu: Convert laptop driver to a platform one Rafael J. Wysocki
2026-03-09 17:10 ` [PATCH v2 4/5] platform/x86: fujitsu: Convert backlight " Rafael J. Wysocki
2026-03-10 0:36 ` [PATCH v2 0/5] platform/x86: fujitsu: Bind drivers to platform devices instead of ACPI ones Jonathan Woithe
2026-03-10 9:48 ` Rafael J. Wysocki
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=1961003.tdWV9SEqCh@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jwoithe@just42.net \
--cc=khnz@gmx.de \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/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