All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wilczynski <michal.wilczynski@intel.com>
To: linux-acpi@vger.kernel.org
Cc: rafael@kernel.org, srinivas.pandruvada@linux.intel.com,
	Michal Wilczynski <michal.wilczynski@intel.com>
Subject: [PATCH v3 25/34] platform/x86/topstar-laptop: Move handler installing logic to driver
Date: Wed, 17 May 2023 09:57:15 +0200	[thread overview]
Message-ID: <20230517075724.153992-26-michal.wilczynski@intel.com> (raw)
In-Reply-To: <20230517075724.153992-1-michal.wilczynski@intel.com>

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_device_install_event_handler().

Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
---
 drivers/platform/x86/topstar-laptop.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
index 20df1ebefc30..87c72625482f 100644
--- a/drivers/platform/x86/topstar-laptop.c
+++ b/drivers/platform/x86/topstar-laptop.c
@@ -232,12 +232,15 @@ static int topstar_acpi_fncx_switch(struct acpi_device *device, bool state)
 	return 0;
 }
 
-static void topstar_acpi_notify(struct acpi_device *device, u32 event)
+static void topstar_acpi_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct topstar_laptop *topstar = acpi_driver_data(device);
+	struct acpi_device *device = data;
+	struct topstar_laptop *topstar;
 	static bool dup_evnt[2];
 	bool *dup;
 
+	topstar = acpi_driver_data(device);
+
 	/* 0x83 and 0x84 key events comes duplicated... */
 	if (event == 0x83 || event == 0x84) {
 		dup = &dup_evnt[event - 0x83];
@@ -319,7 +322,11 @@ static int topstar_acpi_add(struct acpi_device *device)
 			goto err_input_exit;
 	}
 
-	return 0;
+	err = acpi_device_install_event_handler(device, ACPI_DEVICE_NOTIFY, topstar_acpi_notify);
+	if (err)
+		goto err_input_exit;
+
+	return err;
 
 err_input_exit:
 	topstar_input_exit(topstar);
@@ -336,6 +343,8 @@ static void topstar_acpi_remove(struct acpi_device *device)
 {
 	struct topstar_laptop *topstar = acpi_driver_data(device);
 
+	acpi_device_remove_event_handler(device, ACPI_DEVICE_NOTIFY, topstar_acpi_notify);
+
 	if (led_workaround)
 		topstar_led_exit(topstar);
 
@@ -360,7 +369,6 @@ static struct acpi_driver topstar_acpi_driver = {
 	.ops = {
 		.add = topstar_acpi_add,
 		.remove = topstar_acpi_remove,
-		.notify = topstar_acpi_notify,
 	},
 };
 
-- 
2.40.1


  parent reply	other threads:[~2023-05-17  7:59 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17  7:56 [PATCH v3 00/34] Remove .notify callback in acpi_device_ops Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 01/34] acpi: Adjust functions installing bus event handlers Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 02/34] acpi/ac: Move handler installing logic to driver Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 03/34] acpi/video: " Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 04/34] acpi/battery: " Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 05/34] acpi/button: " Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 06/34] acpi/hed: " Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 07/34] acpi/nfit: " Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 08/34] acpi/thermal: " Michal Wilczynski
2023-05-17  7:56 ` [PATCH v3 09/34] acpi/tiny-power-button: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 10/34] hwmon: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 11/34] iio/acpi-als: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 12/34] platform/chromeos_tbmc: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 13/34] platform/wilco_ec: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 14/34] platform/surface/button: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 15/34] platform/x86/acer-wireless: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 16/34] platform/x86/asus-laptop: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 17/34] platform/x86/asus-wireless: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 18/34] platform/x86/classmate-laptop: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 19/34] platform/x86/dell/dell-rbtn: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 20/34] platform/x86/eeepc-laptop: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 21/34] platform/x86/fujitsu-laptop: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 22/34] platform/x86/lg-laptop: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 23/34] platform/x86/panasonic-laptop: " Michal Wilczynski
2023-05-17 15:30   ` kernel test robot
2023-05-17  7:57 ` [PATCH v3 24/34] platform/x86/system76_acpi: " Michal Wilczynski
2023-05-17  7:57 ` Michal Wilczynski [this message]
2023-05-17  7:57 ` [PATCH v3 26/34] platform/x86/toshiba_acpi: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 27/34] platform/x86/toshiba_bluetooth: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 28/34] platform/x86/toshiba_haps: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 29/34] platform/x86/wireless-hotkey: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 30/34] platform/x86/xo15-ebook: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 31/34] virt/vmgenid: " Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 32/34] acpi/bus: Remove installing/removing notify handlers from probe/remove Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 33/34] acpi/bus: Remove redundant functions Michal Wilczynski
2023-05-17  7:57 ` [PATCH v3 34/34] acpi/bus: Remove notify callback and flags Michal Wilczynski
2023-05-17 17:59   ` kernel test robot
2023-05-17  9:35 ` [PATCH v3 00/34] Remove .notify callback in acpi_device_ops Hans de Goede
2023-05-17 10:58   ` Wilczynski, Michal

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=20230517075724.153992-26-michal.wilczynski@intel.com \
    --to=michal.wilczynski@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=srinivas.pandruvada@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.