mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: jlee@suse.com, farhan.anwar8@gmail.com, rayanmargham4@gmail.com
Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH 4/5] platform/x86: acer-wmi: Improve error handling when reading AC status
Date: Sun, 24 Nov 2024 18:14:25 +0100	[thread overview]
Message-ID: <20241124171426.29203-5-W_Armin@gmx.de> (raw)
In-Reply-To: <20241124171426.29203-1-W_Armin@gmx.de>

If a call to ACER_WMID_GET_GAMING_SYS_INFO_METHODID fails, the lower
8 bits will be non-zero. Use WMID_gaming_get_sys_info() to check for
this when reading the AC status.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/acer-wmi.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 7b549920eba7..6964fea84fa1 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1951,12 +1951,9 @@ static int acer_thermal_profile_change(void)
 			return err;

 		/* Check power source */
-		status = WMI_gaming_execute_u64(
-			ACER_WMID_GET_GAMING_SYS_INFO_METHODID,
-			ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS, &on_AC);
-
-		if (ACPI_FAILURE(status))
-			return -EIO;
+		err = WMID_gaming_get_sys_info(ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS, &on_AC);
+		if (err < 0)
+			return err;

 		switch (current_tp) {
 		case ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO:
--
2.39.5


  parent reply	other threads:[~2024-11-24 17:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-24 17:14 [RFC PATCH 0/5] platform/x86: acer-wmi: Various improvements Armin Wolf
2024-11-24 17:14 ` [RFC PATCH 1/5] platform/x86: acer-wmi: Add support for Acer PH14-51 Armin Wolf
2024-11-24 17:14 ` [RFC PATCH 2/5] platform/x86: acer-wmi: Rename ACER_CAP_FAN_SPEED_READ Armin Wolf
2024-11-27 10:06   ` Ilpo Järvinen
2024-11-24 17:14 ` [RFC PATCH 3/5] platform/x86: acer-wmi: Add support for temperature sensors Armin Wolf
2024-11-27 10:35   ` Ilpo Järvinen
2024-11-24 17:14 ` Armin Wolf [this message]
2024-11-27 10:42   ` [RFC PATCH 4/5] platform/x86: acer-wmi: Improve error handling when reading AC status Ilpo Järvinen
2024-11-24 17:14 ` [RFC PATCH 5/5] platform/x86: acer-wmi: Ignore AC events Armin Wolf
2024-11-27 10:44   ` 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=20241124171426.29203-5-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=farhan.anwar8@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jlee@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rayanmargham4@gmail.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

all inboxes | Powered by JetHome®