From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>,
Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org,
Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Subject: [PATCH v2 05/10] platform/x86: classmate-laptop: Register ACPI notify handlers directly
Date: Mon, 11 May 2026 22:08:22 +0200 [thread overview]
Message-ID: <1856277.VLH7GnMWUR@rafael.j.wysocki> (raw)
In-Reply-To: <3415394.44csPzL39Z@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: Rebase
---
drivers/platform/x86/classmate-laptop.c | 66 +++++++++++++++++++++----
1 file changed, 56 insertions(+), 10 deletions(-)
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
index bc229771e7ba..8507483b23f9 100644
--- a/drivers/platform/x86/classmate-laptop.c
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -177,8 +177,10 @@ static acpi_status cmpc_get_accel_v4(acpi_handle handle,
return status;
}
-static void cmpc_accel_handler_v4(struct acpi_device *dev, u32 event)
+static void cmpc_accel_handler_v4(acpi_handle handle, u32 event, void *data)
{
+ struct acpi_device *dev = data;
+
if (event == 0x81) {
int16_t x, y, z;
acpi_status status;
@@ -424,10 +426,17 @@ static int cmpc_accel_add_v4(struct acpi_device *acpi)
if (error)
goto failed_g_select;
+ error = acpi_dev_install_notify_handler(acpi, ACPI_DEVICE_NOTIFY,
+ cmpc_accel_handler_v4, acpi);
+ if (error)
+ goto failed_notify_handler;
+
dev_set_drvdata(&inputdev->dev, accel);
return 0;
+failed_notify_handler:
+ device_remove_file(&acpi->dev, &cmpc_accel_g_select_attr_v4);
failed_g_select:
device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4);
failed_sensitivity:
@@ -437,6 +446,8 @@ static int cmpc_accel_add_v4(struct acpi_device *acpi)
static void cmpc_accel_remove_v4(struct acpi_device *acpi)
{
+ acpi_dev_remove_notify_handler(acpi, ACPI_DEVICE_NOTIFY,
+ cmpc_accel_handler_v4);
device_remove_file(&acpi->dev, &cmpc_accel_g_select_attr_v4);
device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4);
cmpc_remove_notify_device(&acpi->dev);
@@ -457,7 +468,6 @@ static struct acpi_driver cmpc_accel_acpi_driver_v4 = {
.ops = {
.add = cmpc_accel_add_v4,
.remove = cmpc_accel_remove_v4,
- .notify = cmpc_accel_handler_v4,
},
.drv.pm = &cmpc_accel_pm,
};
@@ -539,8 +549,10 @@ static acpi_status cmpc_get_accel(acpi_handle handle,
return status;
}
-static void cmpc_accel_handler(struct acpi_device *dev, u32 event)
+static void cmpc_accel_handler(acpi_handle handle, u32 event, void *data)
{
+ struct acpi_device *dev = data;
+
if (event == 0x81) {
unsigned char x, y, z;
acpi_status status;
@@ -663,10 +675,17 @@ static int cmpc_accel_add(struct acpi_device *acpi)
if (error)
goto failed_file;
+ error = acpi_dev_install_notify_handler(acpi, ACPI_DEVICE_NOTIFY,
+ cmpc_accel_handler, acpi);
+ if (error)
+ goto failed_notify_handler;
+
dev_set_drvdata(&inputdev->dev, accel);
return 0;
+failed_notify_handler:
+ device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr);
failed_file:
cmpc_remove_notify_device(&acpi->dev);
return error;
@@ -674,6 +693,8 @@ static int cmpc_accel_add(struct acpi_device *acpi)
static void cmpc_accel_remove(struct acpi_device *acpi)
{
+ acpi_dev_remove_notify_handler(acpi, ACPI_DEVICE_NOTIFY,
+ cmpc_accel_handler);
device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr);
cmpc_remove_notify_device(&acpi->dev);
}
@@ -690,7 +711,6 @@ static struct acpi_driver cmpc_accel_acpi_driver = {
.ops = {
.add = cmpc_accel_add,
.remove = cmpc_accel_remove,
- .notify = cmpc_accel_handler,
}
};
@@ -716,8 +736,9 @@ static acpi_status cmpc_get_tablet(acpi_handle handle,
return status;
}
-static void cmpc_tablet_handler(struct acpi_device *dev, u32 event)
+static void cmpc_tablet_handler(acpi_handle handle, u32 event, void *data)
{
+ struct acpi_device *dev = data;
unsigned long long val = 0;
struct input_dev *inputdev = dev_get_drvdata(&dev->dev);
@@ -746,11 +767,24 @@ static void cmpc_tablet_idev_init(struct input_dev *inputdev)
static int cmpc_tablet_add(struct acpi_device *acpi)
{
- return cmpc_add_notify_device(&acpi->dev, "cmpc_tablet", cmpc_tablet_idev_init);
+ int error;
+
+ error = cmpc_add_notify_device(&acpi->dev, "cmpc_tablet", cmpc_tablet_idev_init);
+ if (error)
+ return error;
+
+ error = acpi_dev_install_notify_handler(acpi, ACPI_DEVICE_NOTIFY,
+ cmpc_tablet_handler, acpi);
+ if (error)
+ cmpc_remove_notify_device(&acpi->dev);
+
+ return error;
}
static void cmpc_tablet_remove(struct acpi_device *acpi)
{
+ acpi_dev_remove_notify_handler(acpi, ACPI_DEVICE_NOTIFY,
+ cmpc_tablet_handler);
cmpc_remove_notify_device(&acpi->dev);
}
@@ -782,7 +816,6 @@ static struct acpi_driver cmpc_tablet_acpi_driver = {
.ops = {
.add = cmpc_tablet_add,
.remove = cmpc_tablet_remove,
- .notify = cmpc_tablet_handler,
},
.drv.pm = &cmpc_tablet_pm,
};
@@ -1046,8 +1079,9 @@ static int cmpc_keys_codes[] = {
KEY_MAX
};
-static void cmpc_keys_handler(struct acpi_device *dev, u32 event)
+static void cmpc_keys_handler(acpi_handle handle, u32 event, void *data)
{
+ struct acpi_device *dev = data;
struct input_dev *inputdev;
int code = KEY_MAX;
@@ -1069,11 +1103,24 @@ static void cmpc_keys_idev_init(struct input_dev *inputdev)
static int cmpc_keys_add(struct acpi_device *acpi)
{
- return cmpc_add_notify_device(&acpi->dev, "cmpc_keys", cmpc_keys_idev_init);
+ int error;
+
+ error = cmpc_add_notify_device(&acpi->dev, "cmpc_keys", cmpc_keys_idev_init);
+ if (error)
+ return error;
+
+ error = acpi_dev_install_notify_handler(acpi, ACPI_DEVICE_NOTIFY,
+ cmpc_keys_handler, acpi);
+ if (error)
+ cmpc_remove_notify_device(&acpi->dev);
+
+ return error;
}
static void cmpc_keys_remove(struct acpi_device *acpi)
{
+ acpi_dev_remove_notify_handler(acpi, ACPI_DEVICE_NOTIFY,
+ cmpc_keys_handler);
cmpc_remove_notify_device(&acpi->dev);
}
@@ -1089,7 +1136,6 @@ static struct acpi_driver cmpc_keys_acpi_driver = {
.ops = {
.add = cmpc_keys_add,
.remove = cmpc_keys_remove,
- .notify = cmpc_keys_handler,
}
};
--
2.51.0
next prev parent reply other threads:[~2026-05-11 20:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 20:01 [PATCH v2 00/10] platform/x86: classmate-laptop: Bind to platform devices instead of ACPI ones Rafael J. Wysocki
2026-05-11 20:03 ` [PATCH v2 01/10] platform/x86: classmate-laptop: Address memory leaks on driver removal Rafael J. Wysocki
2026-05-11 20:04 ` [PATCH v2 02/10] platform/x86: classmate-laptop: Unify probe rollback and remove code Rafael J. Wysocki
2026-05-11 20:06 ` [PATCH v2 03/10] platform/x86: classmate-laptop: Pass struct device pointer to helpers Rafael J. Wysocki
2026-05-11 20:07 ` [PATCH v2 04/10] platform/x86: classmate-laptop: Rename two helper functions Rafael J. Wysocki
2026-05-11 20:08 ` Rafael J. Wysocki [this message]
2026-05-11 20:10 ` [PATCH v2 06/10] platform/x86: classmate-laptop: Convert v4 accel driver to a platform one Rafael J. Wysocki
2026-05-11 20:11 ` [PATCH v2 07/10] platform/x86: classmate-laptop: Convert " Rafael J. Wysocki
2026-05-11 20:12 ` [PATCH v2 08/10] platform/x86: classmate-laptop: Convert tablet " Rafael J. Wysocki
2026-05-11 20:14 ` [PATCH v2 09/10] platform/x86: classmate-laptop: Convert ipml " Rafael J. Wysocki
2026-05-11 20:15 ` [PATCH v2 10/10] platform/x86: classmate-laptop: Convert keys " Rafael J. Wysocki
2026-05-12 15:09 ` [PATCH v2 00/10] platform/x86: classmate-laptop: Bind to platform devices instead of ACPI ones Thadeu Lima de Souza Cascardo
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=1856277.VLH7GnMWUR@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=cascardo@holoscopio.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--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