linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kelsey Skunberg <skunberg.kelsey@gmail.com>
To: rjw@rjwysocki.net, lenb@kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	bjorn@helgaas.com, skunberg.kelsey@gmail.com
Subject: [PATCH 3/3] ACPI: Remove acpi_has_method() calls from thermal.c
Date: Sun, 21 Jul 2019 20:35:30 -0600	[thread overview]
Message-ID: <20190722023530.67676-4-skunberg.kelsey@gmail.com> (raw)
In-Reply-To: <20190722023530.67676-1-skunberg.kelsey@gmail.com>

The following acpi_has_method() calls are unnecessary since
acpi_execute_simple_method() and acpi_evaluate_reference() will return an
error if the given method does not exist. Remove acpi_has_method() calls
to avoid additional work.

Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
---
 drivers/acpi/thermal.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 00f12a86ecbd..d831a61e0010 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -225,13 +225,9 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
 	if (!tz)
 		return -EINVAL;
 
-	if (!acpi_has_method(tz->device->handle, "_SCP")) {
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
+	if (ACPI_FAILURE(acpi_execute_simple_method(tz->device->handle,
+						    "_SCP", mode)))
 		return -ENODEV;
-	} else if (ACPI_FAILURE(acpi_execute_simple_method(tz->device->handle,
-							   "_SCP", mode))) {
-		return -ENODEV;
-	}
 
 	return 0;
 }
@@ -463,8 +459,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 			break;
 	}
 
-	if ((flag & ACPI_TRIPS_DEVICES)
-	    && acpi_has_method(tz->device->handle, "_TZD")) {
+	if (flag & ACPI_TRIPS_DEVICES) {
 		memset(&devices, 0, sizeof(devices));
 		status = acpi_evaluate_reference(tz->device->handle, "_TZD",
 						NULL, &devices);
-- 
2.20.1


      parent reply	other threads:[~2019-07-22  2:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22  2:35 [PATCH 0/3] ACPI: Remove unnecessary acpi_has_method() calls Kelsey Skunberg
2019-07-22  2:35 ` [PATCH 1/3] ACPI: Remove acpi_has_method() call from acpi_adxl.c Kelsey Skunberg
2019-07-22  8:31   ` Rafael J. Wysocki
2019-07-22 18:29     ` Bjorn Helgaas
2019-09-02 21:08       ` Rafael J. Wysocki
2019-09-05  4:11         ` Kelsey Skunberg
2019-07-22  2:35 ` [PATCH 2/3] ACPI: Remove acpi_has_method() call from scan.c Kelsey Skunberg
2019-07-22  8:29   ` Rafael J. Wysocki
2019-07-22  2:35 ` Kelsey Skunberg [this message]

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=20190722023530.67676-4-skunberg.kelsey@gmail.com \
    --to=skunberg.kelsey@gmail.com \
    --cc=bjorn@helgaas.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=skhan@linuxfoundation.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;
as well as URLs for NNTP newsgroup(s).