Re: [PATCH v2] panasonic-laptop: fix acpi_pcc_write_sset return value

Previous thread: [PATCH -v23 00/49] Use memblock with x86 by Yinghai Lu on Tuesday, July 6, 2010 - 3:38 pm. (26 messages)

Next thread: 2.6.35-rc4 - include/linux/fdtable.h:85 invoked rcu_dereference_check() without protection! by Miles Lane on Tuesday, July 6, 2010 - 5:25 pm. (3 messages)
From: Axel Lin
Date: Tuesday, July 6, 2010 - 5:21 pm

In current implementation, acpi_pcc_write_sset return 1
if write is successful, 0 if write is failed.
But all the callers consider acpi_pcc_write_sset return 0
if write is successful and return negtive if write is failed.

This patch changes the implementation of acpi_pcc_write_sset to
return 0 if write is successful, -EIO if write is failed.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 2fb9a32..ec01c3d 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -248,7 +248,7 @@ static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val)
 	status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET,
 				      &params, NULL);
 
-	return status == AE_OK;
+	return (status == AE_OK) ? 0 : -EIO;
 }
 
 static inline int acpi_pcc_get_sqty(struct acpi_device *device)
@@ -586,7 +586,6 @@ static int acpi_pcc_init_input(struct pcc_acpi *pcc)
 static int acpi_pcc_hotkey_resume(struct acpi_device *device)
 {
 	struct pcc_acpi *pcc = acpi_driver_data(device);
-	acpi_status status = AE_OK;
 
 	if (device == NULL || pcc == NULL)
 		return -EINVAL;
@@ -594,9 +593,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device)
 	ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Sticky mode restore: %d\n",
 			  pcc->sticky_mode));
 
-	status = acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
-
-	return status == AE_OK ? 0 : -EINVAL;
+	return acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
 }
 
 static int acpi_pcc_hotkey_add(struct acpi_device *device)
-- 
1.5.4.3



--

From: Dmitry Torokhov
Date: Tuesday, July 6, 2010 - 5:29 pm

Looks good, but why don't you also kill these useless checks while you
are at it?  Otherwise:

Acked-by: Dmitry Torokhov <dtor@mail.ru>

Thanks.

-- 
Dmitry
--

From: Harald Welte
Date: Tuesday, July 6, 2010 - 10:40 pm

Acked-By: Harald Welte <laforge@gnumonks.org>
-- 
- Harald Welte <laforge@gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)
--

Previous thread: [PATCH -v23 00/49] Use memblock with x86 by Yinghai Lu on Tuesday, July 6, 2010 - 3:38 pm. (26 messages)

Next thread: 2.6.35-rc4 - include/linux/fdtable.h:85 invoked rcu_dereference_check() without protection! by Miles Lane on Tuesday, July 6, 2010 - 5:25 pm. (3 messages)