[PATCH 13/13] eeepc-laptop: return -ENXIO if acpi getter or setter fails

From: Frans Klaver
Date: Fri Sep 12 2014 - 19:08:43 EST


get_acpi() and set_acpi() return -ENODEV on error. However, of the
available options, ENXIO seems more appropriate, since we're dealing
with both devices and addresses here:

#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define ENODEV 19 /* No such device */

One could expect the same applies to acpi_setter_handle(), as this
follows a similar setup. Changing the return values here triggers the
error "Error removing rfkill notify handler" during boot, so we'll leave
that as is.

Signed-off-by: Frans Klaver <fransklaver@xxxxxxxxx>
---
Changing ENODEV to ENXIO in acpi_setter_handle() probably requires some extra
work to get it working properly. I'd propose to dive into that after we finish
this series, or we drop this patch from the series and move the whole return
value issue into a separate patch set. Either way, with the sysfs fixes in
place, I don't think this one is going to make a huge difference in the end.

drivers/platform/x86/eeepc-laptop.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index ad221e0..064ab0d 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -215,9 +215,9 @@ static int set_acpi(struct eeepc_laptop *eeepc, int cm, int value)
const char *method = cm_setv[cm];

if (method == NULL)
- return -ENODEV;
+ return -ENXIO;
if ((eeepc->cm_supported & (0x1 << cm)) == 0)
- return -ENODEV;
+ return -ENXIO;

if (write_acpi_int(eeepc->handle, method, value))
pr_warn("Error writing %s\n", method);
@@ -230,9 +230,9 @@ static int get_acpi(struct eeepc_laptop *eeepc, int cm)
int value;

if (method == NULL)
- return -ENODEV;
+ return -ENXIO;
if ((eeepc->cm_supported & (0x1 << cm)) == 0)
- return -ENODEV;
+ return -ENXIO;

if (read_acpi_int(eeepc->handle, method, &value))
pr_warn("Error reading %s\n", method);
@@ -527,7 +527,7 @@ static int eeepc_led_init(struct eeepc_laptop *eeepc)
{
int rv;

- if (get_acpi(eeepc, CM_ASL_TPD) == -ENODEV)
+ if (get_acpi(eeepc, CM_ASL_TPD) == -ENXIO)
return 0;

eeepc->led_workqueue = create_singlethread_workqueue("led_workqueue");
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/