From: Armin Wolf <W_Armin@gmx.de>
To: james@equiv.tech, jlee@suse.com, corentin.chary@gmail.com,
luke@ljones.dev, matan@svgalib.org, coproscefalo@gmail.com
Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com,
rafael@kernel.org, lenb@kernel.org,
platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] platform/x86: wmi: Merge get_event_data() with wmi_get_notify_data()
Date: Thu, 22 Aug 2024 19:38:09 +0200 [thread overview]
Message-ID: <20240822173810.11090-5-W_Armin@gmx.de> (raw)
In-Reply-To: <20240822173810.11090-1-W_Armin@gmx.de>
Since get_event_data() is only called by wmi_get_notify_data(), it
makes sense to merge both functions.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
drivers/platform/x86/wmi.c | 43 +++++++++++++++-----------------------
1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index c7f0754f74b4..6b27833ba5d9 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -166,22 +166,6 @@ static inline acpi_object_type get_param_acpi_type(const struct wmi_block *wbloc
return ACPI_TYPE_BUFFER;
}
-static acpi_status get_event_data(const struct wmi_block *wblock, struct acpi_buffer *out)
-{
- union acpi_object param = {
- .integer = {
- .type = ACPI_TYPE_INTEGER,
- .value = wblock->gblock.notify_id,
- }
- };
- struct acpi_object_list input = {
- .count = 1,
- .pointer = ¶m,
- };
-
- return acpi_evaluate_object(wblock->acpi_device->handle, "_WED", &input, out);
-}
-
static int wmidev_match_guid(struct device *dev, const void *data)
{
struct wmi_block *wblock = dev_to_wblock(dev);
@@ -1129,14 +1113,19 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
static int wmi_get_notify_data(struct wmi_block *wblock, union acpi_object **obj)
{
struct acpi_buffer data = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object param = {
+ .integer = {
+ .type = ACPI_TYPE_INTEGER,
+ .value = wblock->gblock.notify_id,
+ }
+ };
+ struct acpi_object_list input = {
+ .count = 1,
+ .pointer = ¶m,
+ };
acpi_status status;
- if (test_bit(WMI_NO_EVENT_DATA, &wblock->flags)) {
- *obj = NULL;
- return 0;
- }
-
- status = get_event_data(wblock, &data);
+ status = acpi_evaluate_object(wblock->acpi_device->handle, "_WED", &input, &data);
if (ACPI_FAILURE(status)) {
dev_warn(&wblock->dev.dev, "Failed to get event data\n");
return -EIO;
@@ -1163,7 +1152,7 @@ static void wmi_notify_driver(struct wmi_block *wblock, union acpi_object *obj)
static int wmi_notify_device(struct device *dev, void *data)
{
struct wmi_block *wblock = dev_to_wblock(dev);
- union acpi_object *obj;
+ union acpi_object *obj = NULL;
u32 *event = data;
int ret;
@@ -1179,9 +1168,11 @@ static int wmi_notify_device(struct device *dev, void *data)
* WMI driver core stops evaluating _WED due to missing
* WMI event consumers.
*/
- ret = wmi_get_notify_data(wblock, &obj);
- if (ret < 0)
- return -EIO;
+ if (!test_bit(WMI_NO_EVENT_DATA, &wblock->flags)) {
+ ret = wmi_get_notify_data(wblock, &obj);
+ if (ret < 0)
+ return -EIO;
+ }
down_read(&wblock->notify_lock);
/* The WMI driver notify handler conflicts with the legacy WMI handler.
--
2.39.2
next prev parent reply other threads:[~2024-08-22 17:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 17:38 [PATCH 0/5] platform/x86: wmi: Pass event data directly to legacy notify handlers Armin Wolf
2024-08-22 17:38 ` [PATCH 1/5] " Armin Wolf
2024-08-27 8:32 ` Ilpo Järvinen
2024-08-22 17:38 ` [PATCH 2/5] hwmon: (hp-wmi-sensors) Check if WMI event data exists Armin Wolf
2024-08-23 5:57 ` James Seo
2024-08-23 6:03 ` Guenter Roeck
2024-08-27 8:20 ` Ilpo Järvinen
2024-08-27 22:11 ` Armin Wolf
2024-08-22 17:38 ` [PATCH 3/5] platform/x86: wmi: Remove wmi_get_event_data() Armin Wolf
2024-08-27 8:33 ` Ilpo Järvinen
2024-08-22 17:38 ` Armin Wolf [this message]
2024-08-27 8:36 ` [PATCH 4/5] platform/x86: wmi: Merge get_event_data() with wmi_get_notify_data() Ilpo Järvinen
2024-08-22 17:38 ` [PATCH 5/5] platform/x86: wmi: Call both legacy and WMI driver notify handlers Armin Wolf
2024-08-22 18:04 ` [PATCH 0/5] platform/x86: wmi: Pass event data directly to legacy " Hans de Goede
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=20240822173810.11090-5-W_Armin@gmx.de \
--to=w_armin@gmx.de \
--cc=coproscefalo@gmail.com \
--cc=corentin.chary@gmail.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=james@equiv.tech \
--cc=jlee@suse.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=matan@svgalib.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@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