aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/eeepc-laptop.c
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-12-03 02:44:59 -0500
committerLen Brown <len.brown@intel.com>2009-12-09 15:54:31 -0500
commit13f70029daa3cd7f9983e4aec82f32939b1a6e6a (patch)
treea4e2e628f67efcaba1b1da1af274231425c75455 /drivers/platform/x86/eeepc-laptop.c
parentdc56ad9b49d20e38bb9745bf3beca84291b21a51 (diff)
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: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/eeepc-laptop.c')
-rw-r--r--drivers/platform/x86/eeepc-laptop.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 8b686b563ec0..abd7389a4493 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -289,26 +289,30 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
289 289
290static int set_acpi(int cm, int value) 290static int set_acpi(int cm, int value)
291{ 291{
292 if (ehotk->cm_supported & (0x1 << cm)) { 292 const char *method = cm_setv[cm];
293 const char *method = cm_setv[cm]; 293
294 if (method == NULL) 294 if (method == NULL)
295 return -ENODEV; 295 return -ENODEV;
296 if (write_acpi_int(ehotk->handle, method, value, NULL)) 296 if ((ehotk->cm_supported & (0x1 << cm)) == 0)
297 pr_warning("Error writing %s\n", method); 297 return -ENODEV;
298 } 298
299 if (write_acpi_int(ehotk->handle, method, value, NULL))
300 pr_warning("Error writing %s\n", method);
299 return 0; 301 return 0;
300} 302}
301 303
302static int get_acpi(int cm) 304static int get_acpi(int cm)
303{ 305{
304 int value = -ENODEV; 306 const char *method = cm_getv[cm];
305 if ((ehotk->cm_supported & (0x1 << cm))) { 307 int value;
306 const char *method = cm_getv[cm]; 308
307 if (method == NULL) 309 if (method == NULL)
308 return -ENODEV; 310 return -ENODEV;
309 if (read_acpi_int(ehotk->handle, method, &value)) 311 if ((ehotk->cm_supported & (0x1 << cm)) == 0)
310 pr_warning("Error reading %s\n", method); 312 return -ENODEV;
311 } 313
314 if (read_acpi_int(ehotk->handle, method, &value))
315 pr_warning("Error reading %s\n", method);
312 return value; 316 return value;
313} 317}
314 318