public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: 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,
	Jeremy Soller <jeremy@system76.com>,
	System76 Product Development <productdev@system76.com>
Subject: [PATCH v1 1/2] platform/x86: system76: Register ACPI notify handler directly
Date: Thu, 12 Mar 2026 15:13:50 +0100	[thread overview]
Message-ID: <6265962.lOV4Wx5bFT@rafael.j.wysocki> (raw)
In-Reply-To: <2841136.mvXUDI8C0e@rafael.j.wysocki>

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/system76_acpi.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/system76_acpi.c b/drivers/platform/x86/system76_acpi.c
index 3da753b3d00d..35e294a55fa3 100644
--- a/drivers/platform/x86/system76_acpi.c
+++ b/drivers/platform/x86/system76_acpi.c
@@ -644,11 +644,10 @@ static void input_key(struct system76_data *data, unsigned int code)
 }
 
 // Handle ACPI notification
-static void system76_notify(struct acpi_device *acpi_dev, u32 event)
+static void system76_notify(acpi_handle handle, u32 event, void *context)
 {
-	struct system76_data *data;
+	struct system76_data *data = context;
 
-	data = acpi_driver_data(acpi_dev);
 	switch (event) {
 	case 0x80:
 		kb_led_hotkey_hardware(data);
@@ -777,6 +776,15 @@ static int system76_add(struct acpi_device *acpi_dev)
 		system76_battery_init();
 	}
 
+	err = acpi_dev_install_notify_handler(acpi_dev, ACPI_DEVICE_NOTIFY,
+					      system76_notify, data);
+	if (err) {
+		if (data->has_open_ec)
+			system76_battery_exit();
+
+		goto error;
+	}
+
 	return 0;
 
 error:
@@ -792,6 +800,8 @@ static void system76_remove(struct acpi_device *acpi_dev)
 {
 	struct system76_data *data;
 
+	acpi_dev_remove_notify_handler(acpi_dev, ACPI_DEVICE_NOTIFY, system76_notify);
+
 	data = acpi_driver_data(acpi_dev);
 
 	if (data->has_open_ec) {
@@ -813,7 +823,6 @@ static struct acpi_driver system76_driver = {
 	.ops = {
 		.add = system76_add,
 		.remove = system76_remove,
-		.notify = system76_notify,
 	},
 };
 module_acpi_driver(system76_driver);
-- 
2.51.0





  reply	other threads:[~2026-03-12 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 14:09 [PATCH v1 0/2] platform/x86: system76: Bind to a platform device instead of an ACPI one Rafael J. Wysocki
2026-03-12 14:13 ` Rafael J. Wysocki [this message]
2026-03-12 14:28 ` [PATCH v1 2/2] platform/x86: system76: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-12 16:09   ` Jeremy Soller
2026-03-12 16:29     ` Rafael J. Wysocki
2026-03-17 17:48   ` Ilpo Järvinen
2026-03-17 19:04     ` Rafael J. Wysocki
2026-03-18 11:51       ` Ilpo Järvinen

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=6265962.lOV4Wx5bFT@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jeremy@system76.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=productdev@system76.com \
    /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