diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2009-12-03 02:44:45 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-09 15:54:29 -0500 |
commit | 6dff29b63a5bf2eaf3313cb8a84f0b7520c43401 (patch) | |
tree | f731af48a00c3dec92675924a916dd7b1b3e0868 /drivers/platform/x86/eeepc-laptop.c | |
parent | 22763c5cf3690a681551162c15d34d935308c8d7 (diff) |
eeepc-laptop: disp attribute should be write-only
Currently, reading from the disp attribute fails with "No such device",
which is misleading. According to CMSG table on acpi4asus project site,
no models have a getter method corresponding to SDSP. Change the file
permission to disallow reads.
If some joker changes the permission to permit reads, then return -EIO
to be consistent with sysfs' behaviour when no show() method is
provided.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
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.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 4226e5352738..2c65a3772968 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -380,7 +380,7 @@ static ssize_t store_sys_acpi(int cm, const char *buf, size_t count) | |||
380 | if (rv > 0) | 380 | if (rv > 0) |
381 | value = set_acpi(cm, value); | 381 | value = set_acpi(cm, value); |
382 | if (value < 0) | 382 | if (value < 0) |
383 | return value; | 383 | return -EIO; |
384 | return rv; | 384 | return rv; |
385 | } | 385 | } |
386 | 386 | ||
@@ -389,11 +389,11 @@ static ssize_t show_sys_acpi(int cm, char *buf) | |||
389 | int value = get_acpi(cm); | 389 | int value = get_acpi(cm); |
390 | 390 | ||
391 | if (value < 0) | 391 | if (value < 0) |
392 | return value; | 392 | return -EIO; |
393 | return sprintf(buf, "%d\n", value); | 393 | return sprintf(buf, "%d\n", value); |
394 | } | 394 | } |
395 | 395 | ||
396 | #define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \ | 396 | #define EEEPC_CREATE_DEVICE_ATTR(_name, _mode, _cm) \ |
397 | static ssize_t show_##_name(struct device *dev, \ | 397 | static ssize_t show_##_name(struct device *dev, \ |
398 | struct device_attribute *attr, \ | 398 | struct device_attribute *attr, \ |
399 | char *buf) \ | 399 | char *buf) \ |
@@ -409,14 +409,14 @@ static ssize_t show_sys_acpi(int cm, char *buf) | |||
409 | static struct device_attribute dev_attr_##_name = { \ | 409 | static struct device_attribute dev_attr_##_name = { \ |
410 | .attr = { \ | 410 | .attr = { \ |
411 | .name = __stringify(_name), \ | 411 | .name = __stringify(_name), \ |
412 | .mode = 0644 }, \ | 412 | .mode = _mode }, \ |
413 | .show = show_##_name, \ | 413 | .show = show_##_name, \ |
414 | .store = store_##_name, \ | 414 | .store = store_##_name, \ |
415 | } | 415 | } |
416 | 416 | ||
417 | EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); | 417 | EEEPC_CREATE_DEVICE_ATTR(camera, 0644, CM_ASL_CAMERA); |
418 | EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); | 418 | EEEPC_CREATE_DEVICE_ATTR(cardr, 0644, CM_ASL_CARDREADER); |
419 | EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); | 419 | EEEPC_CREATE_DEVICE_ATTR(disp, 0200, CM_ASL_DISPLAYSWITCH); |
420 | 420 | ||
421 | struct eeepc_cpufv { | 421 | struct eeepc_cpufv { |
422 | int num; | 422 | int num; |