aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2009-06-25 07:25:40 -0400
committerLen Brown <len.brown@intel.com>2009-06-26 00:23:40 -0400
commitf36509e7248631671d02f48d1a88f56cdeb54ed8 (patch)
treeab824b65e1dce46dc784666301863ed012b1e340 /drivers
parent1ddec2f9435e77b4d3f50eced68c4c942f2bcd4b (diff)
eeepc-laptop: makes get_acpi() returns -ENODEV
If there is there is no getter defined, get_acpi() will return -ENODEV. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/eeepc-laptop.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 5b102c2f66a0..19cc9ae7db5a 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -289,7 +289,7 @@ static int set_acpi(int cm, int value)
289 289
290static int get_acpi(int cm) 290static int get_acpi(int cm)
291{ 291{
292 int value = -1; 292 int value = -ENODEV;
293 if ((ehotk->cm_supported & (0x1 << cm))) { 293 if ((ehotk->cm_supported & (0x1 << cm))) {
294 const char *method = cm_getv[cm]; 294 const char *method = cm_getv[cm];
295 if (method == NULL) 295 if (method == NULL)
@@ -367,13 +367,19 @@ static ssize_t store_sys_acpi(int cm, const char *buf, size_t count)
367 367
368 rv = parse_arg(buf, count, &value); 368 rv = parse_arg(buf, count, &value);
369 if (rv > 0) 369 if (rv > 0)
370 set_acpi(cm, value); 370 value = set_acpi(cm, value);
371 if (value < 0)
372 return value;
371 return rv; 373 return rv;
372} 374}
373 375
374static ssize_t show_sys_acpi(int cm, char *buf) 376static ssize_t show_sys_acpi(int cm, char *buf)
375{ 377{
376 return sprintf(buf, "%d\n", get_acpi(cm)); 378 int value = get_acpi(cm);
379
380 if (value < 0)
381 return value;
382 return sprintf(buf, "%d\n", value);
377} 383}
378 384
379#define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \ 385#define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \
@@ -1036,8 +1042,9 @@ static int eeepc_new_rfkill(struct rfkill **rfkill,
1036{ 1042{
1037 int result; 1043 int result;
1038 1044
1039 if (get_acpi(cm) == -1) 1045 result = get_acpi(cm);
1040 return -ENODEV; 1046 if (result < 0)
1047 return result;
1041 1048
1042 *rfkill = rfkill_alloc(name, dev, type, 1049 *rfkill = rfkill_alloc(name, dev, type,
1043 &eeepc_rfkill_ops, (void *)(unsigned long)cm); 1050 &eeepc_rfkill_ops, (void *)(unsigned long)cm);