Skip to contentSkip to conversation

panasonic-laptop: fix acpi_pcc_write_sset return value

PATCH Superseded Axel Lin 2 participants 2 messages Jul 6, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 panasonic-laptop: fix acpi_pcc_write_sset return value

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.

---
 drivers/platform/x86/panasonic-laptop.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/panasonic-laptop.c +4 -4
index 2fb9a32..d36cbf8 100644
@@ -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)
Signature · 1 line
1.5.4.3
#1 lore raw

Hi Axel,

Quoted 5 lines · Axel Lin

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.

Quoted 2 lines

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.

Signature · 1 line
Dmitry