Linux ACPI
 help / color / mirror / Atom feed
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,
	Azael Avalos <coproscefalo@gmail.com>
Subject: [PATCH v1 2/7] platform/x86: toshiba_acpi: Register ACPI notify handler directly
Date: Tue, 24 Mar 2026 20:58:48 +0100	[thread overview]
Message-ID: <5070377.GXAFRqVoOG@rafael.j.wysocki> (raw)
In-Reply-To: <6262981.lOV4Wx5bFT@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/toshiba_acpi.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index fbd7b6b6b826..b839f62ec9cc 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -223,6 +223,7 @@ struct toshiba_acpi_dev {
 	unsigned int cooling_method_supported:1;
 	unsigned int battery_charge_mode_supported:1;
 	unsigned int sysfs_created:1;
+	unsigned int notify_handler_installed:1;
 	unsigned int special_functions;
 
 	bool kbd_event_generated;
@@ -3193,9 +3194,10 @@ static void print_supported_features(struct toshiba_acpi_dev *dev)
 	pr_cont("\n");
 }
 
-static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event)
+static void toshiba_acpi_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev);
+	struct toshiba_acpi_dev *dev = data;
+	struct acpi_device *acpi_dev = dev->acpi_dev;
 
 	switch (event) {
 	case 0x80: /* Hotkeys and some system events */
@@ -3261,6 +3263,10 @@ static void toshiba_acpi_remove(struct acpi_device *acpi_dev)
 
 	remove_toshiba_proc_entries(dev);
 
+	if (dev->notify_handler_installed)
+		acpi_dev_remove_notify_handler(acpi_dev, ACPI_DEVICE_NOTIFY,
+					       toshiba_acpi_notify);
+
 #if IS_ENABLED(CONFIG_HWMON)
 	if (dev->hwmon_device)
 		hwmon_device_unregister(dev->hwmon_device);
@@ -3537,6 +3543,13 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
 	}
 	dev->sysfs_created = !ret;
 
+	ret = acpi_dev_install_notify_handler(acpi_dev, ACPI_DEVICE_NOTIFY,
+					      toshiba_acpi_notify, dev);
+	if (ret)
+		goto error;
+
+	dev->notify_handler_installed = 1;
+
 	create_toshiba_proc_entries(dev);
 
 	toshiba_acpi = dev;
@@ -3602,7 +3615,6 @@ static struct acpi_driver toshiba_acpi_driver = {
 	.ops	= {
 		.add		= toshiba_acpi_add,
 		.remove		= toshiba_acpi_remove,
-		.notify		= toshiba_acpi_notify,
 	},
 	.drv.pm	= &toshiba_acpi_pm,
 };
-- 
2.51.0





  parent reply	other threads:[~2026-03-24 20:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 19:57 [PATCH v1 0/7] platform/x86: toshiba: Bind to platform devices instead of ACPI ones Rafael J. Wysocki
2026-03-24 19:58 ` [PATCH v1 1/7] platform/x86: toshiba_acpi: Reorder code to avoid forward declaration Rafael J. Wysocki
2026-03-24 19:58 ` Rafael J. Wysocki [this message]
2026-03-24 20:00 ` [PATCH v1 3/7] platform/x86: toshiba_acpi: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-24 20:00 ` [PATCH v1 4/7] platform/x86: toshiba_bluetooth: Register ACPI notify handler directly Rafael J. Wysocki
2026-03-24 20:01 ` [PATCH v1 5/7] platform/x86: toshiba_bluetooth: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-24 20:02 ` [PATCH v1 6/7] platform/x86: toshiba_haps: Register ACPI notify handler directly Rafael J. Wysocki
2026-03-24 20:03 ` [PATCH v1 7/7] platform/x86: toshiba_haps: Convert ACPI driver to a platform one Rafael J. Wysocki
2026-03-31 16:41 ` [PATCH v1 0/7] platform/x86: toshiba: Bind to platform devices instead of ACPI ones 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=5070377.GXAFRqVoOG@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=coproscefalo@gmail.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