Commit 13f70029 authored by Alan Jenkins's avatar Alan Jenkins Committed by Len Brown

eeepc-laptop: fix set_acpi() to return non-zero on failure

If the control method does not exist, return -ENODEV for consistency
with get_acpi()
Signed-off-by: default avatarAlan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent dc56ad9b
...@@ -289,26 +289,30 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val) ...@@ -289,26 +289,30 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
static int set_acpi(int cm, int value) static int set_acpi(int cm, int value)
{ {
if (ehotk->cm_supported & (0x1 << cm)) { const char *method = cm_setv[cm];
const char *method = cm_setv[cm];
if (method == NULL) if (method == NULL)
return -ENODEV; return -ENODEV;
if (write_acpi_int(ehotk->handle, method, value, NULL)) if ((ehotk->cm_supported & (0x1 << cm)) == 0)
pr_warning("Error writing %s\n", method); return -ENODEV;
}
if (write_acpi_int(ehotk->handle, method, value, NULL))
pr_warning("Error writing %s\n", method);
return 0; return 0;
} }
static int get_acpi(int cm) static int get_acpi(int cm)
{ {
int value = -ENODEV; const char *method = cm_getv[cm];
if ((ehotk->cm_supported & (0x1 << cm))) { int value;
const char *method = cm_getv[cm];
if (method == NULL) if (method == NULL)
return -ENODEV; return -ENODEV;
if (read_acpi_int(ehotk->handle, method, &value)) if ((ehotk->cm_supported & (0x1 << cm)) == 0)
pr_warning("Error reading %s\n", method); return -ENODEV;
}
if (read_acpi_int(ehotk->handle, method, &value))
pr_warning("Error reading %s\n", method);
return value; return value;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment