Commit f36509e7 authored by Corentin Chary's avatar Corentin Chary Committed by Len Brown

eeepc-laptop: makes get_acpi() returns -ENODEV

If there is there is no getter defined, get_acpi()
will return -ENODEV.
Signed-off-by: default avatarCorentin Chary <corentincj@iksaif.net>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 1ddec2f9
...@@ -289,7 +289,7 @@ static int set_acpi(int cm, int value) ...@@ -289,7 +289,7 @@ static int set_acpi(int cm, int value)
static int get_acpi(int cm) static int get_acpi(int cm)
{ {
int value = -1; int value = -ENODEV;
if ((ehotk->cm_supported & (0x1 << cm))) { if ((ehotk->cm_supported & (0x1 << cm))) {
const char *method = cm_getv[cm]; const char *method = cm_getv[cm];
if (method == NULL) if (method == NULL)
...@@ -367,13 +367,19 @@ static ssize_t store_sys_acpi(int cm, const char *buf, size_t count) ...@@ -367,13 +367,19 @@ static ssize_t store_sys_acpi(int cm, const char *buf, size_t count)
rv = parse_arg(buf, count, &value); rv = parse_arg(buf, count, &value);
if (rv > 0) if (rv > 0)
set_acpi(cm, value); value = set_acpi(cm, value);
if (value < 0)
return value;
return rv; return rv;
} }
static ssize_t show_sys_acpi(int cm, char *buf) static ssize_t show_sys_acpi(int cm, char *buf)
{ {
return sprintf(buf, "%d\n", get_acpi(cm)); int value = get_acpi(cm);
if (value < 0)
return value;
return sprintf(buf, "%d\n", value);
} }
#define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \ #define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \
...@@ -1036,8 +1042,9 @@ static int eeepc_new_rfkill(struct rfkill **rfkill, ...@@ -1036,8 +1042,9 @@ static int eeepc_new_rfkill(struct rfkill **rfkill,
{ {
int result; int result;
if (get_acpi(cm) == -1) result = get_acpi(cm);
return -ENODEV; if (result < 0)
return result;
*rfkill = rfkill_alloc(name, dev, type, *rfkill = rfkill_alloc(name, dev, type,
&eeepc_rfkill_ops, (void *)(unsigned long)cm); &eeepc_rfkill_ops, (void *)(unsigned long)cm);
......
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