Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1616637

[PATCH v2 2/3] platform/x86: fujitsu-laptop: simplify call_fext_func()

From Michał Kępień <kernel@kempniu.pl>
Newsgroups linux.kernel
Subject [PATCH v2 2/3] platform/x86: fujitsu-laptop: simplify call_fext_func()
Date 2017-04-05 09:00 +0200
Message-ID <tsN58-7C6-23@gated-at.bofh.it> (permalink)
References <tsN57-7C6-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


acpi_evaluate_integer() takes a pathname parameter which contains the
name of the entity to evaluate underneath the given handle, so calling
acpi_get_handle() beforehand is redundant.  Replace the call to
acpi_get_handle() with a call to acpi_evaluate_integer(), thus
eliminating the need for a local variable storing the handle.  Update
debug message to reflect this change.  Adjust whitespace to make
checkpatch happy.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
 drivers/platform/x86/fujitsu-laptop.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index ca1491ff659e..8c41968d9e7f 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -228,20 +228,11 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
 	struct acpi_object_list arg_list = { 4, params };
 	unsigned long long value;
 	acpi_status status;
-	acpi_handle handle;
 
-	status = acpi_get_handle(fujitsu_laptop->acpi_handle, "FUNC", &handle);
+	status = acpi_evaluate_integer(fujitsu_laptop->acpi_handle, "FUNC",
+				       &arg_list, &value);
 	if (ACPI_FAILURE(status)) {
-		vdbg_printk(FUJLAPTOP_DBG_ERROR,
-				"FUNC interface is not present\n");
-		return -ENODEV;
-	}
-
-	status = acpi_evaluate_integer(handle, NULL, &arg_list, &value);
-	if (ACPI_FAILURE(status)) {
-		vdbg_printk(FUJLAPTOP_DBG_WARN,
-			"FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n",
-				cmd, arg0, arg1, arg2);
+		vdbg_printk(FUJLAPTOP_DBG_ERROR, "Failed to evaluate FUNC\n");
 		return -ENODEV;
 	}
 
-- 
2.12.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/3] fujitsu-laptop: call_fext_func() cleanup Michał Kępień <kernel@kempniu.pl> - 2017-04-05 09:00 +0200
  [PATCH v2 2/3] platform/x86: fujitsu-laptop: simplify call_fext_func() Michał Kępień <kernel@kempniu.pl> - 2017-04-05 09:00 +0200
  [PATCH v2 3/3] platform/x86: fujitsu-laptop: rename call_fext_func() arguments Michał Kępień <kernel@kempniu.pl> - 2017-04-05 09:00 +0200
  Re: [PATCH v2 0/3] fujitsu-laptop: call_fext_func() cleanup Darren Hart <dvhart@infradead.org> - 2017-04-05 17:40 +0200
    Re: [PATCH v2 0/3] fujitsu-laptop: call_fext_func() cleanup Michał Kępień <kernel@kempniu.pl> - 2017-04-05 21:50 +0200

csiph-web