public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] panasonic-laptop: fix acpi_pcc_write_sset return value
@ 2010-07-06  6:46 Axel Lin
  2010-07-06 16:28 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-07-06  6:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Harald Welte, Matthew Garrett, Richard Purdie,
	Márton Németh, Jiri Kosina, Dmitry Torokhov,
	platform-driver-x86

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 negative if write is failed.

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

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

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 2fb9a32..d36cbf8 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 : -1;
 }
 
 static inline int acpi_pcc_get_sqty(struct acpi_device *device)
@@ -586,7 +586,7 @@ 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;
+	int ret;
 
 	if (device == NULL || pcc == NULL)
 		return -EINVAL;
@@ -594,9 +594,9 @@ 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);
+	ret = acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
 
-	return status == AE_OK ? 0 : -EINVAL;
+	return (ret < 0) ? -EINVAL : 0;
 }
 
 static int acpi_pcc_hotkey_add(struct acpi_device *device)
-- 
1.5.4.3




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] panasonic-laptop: fix acpi_pcc_write_sset return value
  2010-07-06  6:46 [PATCH] panasonic-laptop: fix acpi_pcc_write_sset return value Axel Lin
@ 2010-07-06 16:28 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2010-07-06 16:28 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Harald Welte, Matthew Garrett, Richard Purdie,
	Márton Németh, Jiri Kosina, platform-driver-x86

Hi Axel,

On Tue, Jul 06, 2010 at 02:46:58PM +0800, Axel Lin wrote:
> 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 negative if write is failed.
>

Yes, I think most of the times we see AE_* outside of
drivers/acpi/acpica it is an error; we should be using standard eoro
codes instead.

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

Why not use something better than -1, maybe -EIO, and the propagate that
return code up the stack?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-06 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-06  6:46 [PATCH] panasonic-laptop: fix acpi_pcc_write_sset return value Axel Lin
2010-07-06 16:28 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox