public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 02/35] acpi/ac: Move handler installing logic to driver
@ 2023-06-01 13:17 Michal Wilczynski
  2023-06-01 13:17 ` [PATCH v4 03/35] acpi/video: " Michal Wilczynski
                   ` (29 more replies)
  0 siblings, 30 replies; 44+ messages in thread
From: Michal Wilczynski @ 2023-06-01 13:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Michal Wilczynski, linux-acpi, platform-driver-x86

Currently logic for installing notifications from ACPI devices is
implemented using notify callback in struct acpi_driver. Preparations
are being made to replace acpi_driver with more generic struct
platform_driver, which doesn't contain notify callback. Furthermore
as of now handlers are being called indirectly through
acpi_notify_device(), which decreases performance.

Call acpi_device_install_event_handler() at the end of .add callback.
Call acpi_device_remove_event_handler() at the beginning of .remove
callback. Change arguments passed to the notify callback to match with
what's required by acpi_install_event_handler().

Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
---
 drivers/acpi/ac.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 1ace70b831cd..208af5a3106e 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -34,7 +34,7 @@ MODULE_LICENSE("GPL");
 
 static int acpi_ac_add(struct acpi_device *device);
 static void acpi_ac_remove(struct acpi_device *device);
-static void acpi_ac_notify(struct acpi_device *device, u32 event);
+static void acpi_ac_notify(acpi_handle handle, u32 event, void *data);
 
 static const struct acpi_device_id ac_device_ids[] = {
 	{"ACPI0003", 0},
@@ -54,11 +54,9 @@ static struct acpi_driver acpi_ac_driver = {
 	.name = "ac",
 	.class = ACPI_AC_CLASS,
 	.ids = ac_device_ids,
-	.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
 	.ops = {
 		.add = acpi_ac_add,
 		.remove = acpi_ac_remove,
-		.notify = acpi_ac_notify,
 		},
 	.drv.pm = &acpi_ac_pm,
 };
@@ -128,9 +126,12 @@ static enum power_supply_property ac_props[] = {
 };
 
 /* Driver Model */
-static void acpi_ac_notify(struct acpi_device *device, u32 event)
+static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct acpi_ac *ac = acpi_driver_data(device);
+	struct acpi_device *device = data;
+	struct acpi_ac *ac;
+
+	ac = acpi_driver_data(device);
 
 	if (!ac)
 		return;
@@ -256,6 +257,8 @@ static int acpi_ac_add(struct acpi_device *device)
 
 	ac->battery_nb.notifier_call = acpi_ac_battery_notify;
 	register_acpi_notifier(&ac->battery_nb);
+
+	result = acpi_device_install_event_handler(device, ACPI_ALL_NOTIFY, acpi_ac_notify);
 end:
 	if (result)
 		kfree(ac);
@@ -297,6 +300,7 @@ static void acpi_ac_remove(struct acpi_device *device)
 
 	ac = acpi_driver_data(device);
 
+	acpi_device_remove_event_handler(device, ACPI_ALL_NOTIFY, acpi_ac_notify);
 	power_supply_unregister(ac->charger);
 	unregister_acpi_notifier(&ac->battery_nb);
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2023-06-04 10:53 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-01 13:17 [PATCH v4 02/35] acpi/ac: Move handler installing logic to driver Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 03/35] acpi/video: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 04/35] acpi/battery: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 05/35] acpi/button: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 06/35] acpi/hed: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 07/35] acpi/nfit: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 08/35] acpi/thermal: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 09/35] acpi/tiny-power-button: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 10/35] hwmon/acpi_power_meter: " Michal Wilczynski
2023-06-01 13:51   ` Guenter Roeck
2023-06-01 13:17 ` [PATCH v4 11/35] iio/acpi-als: " Michal Wilczynski
2023-06-04 10:53   ` Jonathan Cameron
2023-06-01 13:17 ` [PATCH v4 12/35] platform/chromeos_tbmc: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 13/35] platform/wilco_ec: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 14/35] platform/surface/button: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 15/35] platform/x86/acer-wireless: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 16/35] platform/x86/asus-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 17/35] platform/x86/asus-wireless: " Michal Wilczynski
2023-06-02 13:09   ` Ilpo Järvinen
2023-06-02 13:16     ` Wilczynski, Michal
2023-06-01 13:17 ` [PATCH v4 18/35] platform/x86/classmate-laptop: " Michal Wilczynski
2023-06-02 10:29   ` Thadeu Lima de Souza Cascardo
2023-06-02 13:25     ` Wilczynski, Michal
2023-06-01 13:17 ` [PATCH v4 19/35] platform/x86/dell/dell-rbtn: " Michal Wilczynski
2023-06-02 13:20   ` Ilpo Järvinen
2023-06-02 13:41     ` Wilczynski, Michal
2023-06-02 14:01       ` Ilpo Järvinen
2023-06-01 13:17 ` [PATCH v4 20/35] platform/x86/eeepc-laptop: " Michal Wilczynski
2023-06-02 13:24   ` Ilpo Järvinen
2023-06-01 13:17 ` [PATCH v4 21/35] platform/x86/fujitsu-laptop: " Michal Wilczynski
2023-06-02 13:30   ` Ilpo Järvinen
2023-06-02 13:49     ` Wilczynski, Michal
2023-06-02 13:55       ` Ilpo Järvinen
2023-06-01 13:17 ` [PATCH v4 22/35] platform/x86/lg-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 23/35] platform/x86/panasonic-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 24/35] platform/x86/system76_acpi: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 25/35] platform/x86/topstar-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 26/35] platform/x86/toshiba_acpi: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 27/35] platform/x86/toshiba_bluetooth: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 28/35] platform/x86/toshiba_haps: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 29/35] platform/x86/wireless-hotkey: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 30/35] platform/x86/xo15-ebook: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 31/35] platform/x86/sony-laptop: " Michal Wilczynski
2023-06-01 13:17 ` [PATCH v4 32/35] virt/vmgenid: " Michal Wilczynski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox