Commit 6dff29b6 authored by Alan Jenkins's avatar Alan Jenkins Committed by Len Brown

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: default avatarAlan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: default avatarCorentin Chary <corentincj@iksaif.net>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 22763c5c
...@@ -380,7 +380,7 @@ static ssize_t store_sys_acpi(int cm, const char *buf, size_t count) ...@@ -380,7 +380,7 @@ static ssize_t store_sys_acpi(int cm, const char *buf, size_t count)
if (rv > 0) if (rv > 0)
value = set_acpi(cm, value); value = set_acpi(cm, value);
if (value < 0) if (value < 0)
return value; return -EIO;
return rv; return rv;
} }
...@@ -389,11 +389,11 @@ static ssize_t show_sys_acpi(int cm, char *buf) ...@@ -389,11 +389,11 @@ static ssize_t show_sys_acpi(int cm, char *buf)
int value = get_acpi(cm); int value = get_acpi(cm);
if (value < 0) if (value < 0)
return value; return -EIO;
return sprintf(buf, "%d\n", value); return sprintf(buf, "%d\n", value);
} }
#define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \ #define EEEPC_CREATE_DEVICE_ATTR(_name, _mode, _cm) \
static ssize_t show_##_name(struct device *dev, \ static ssize_t show_##_name(struct device *dev, \
struct device_attribute *attr, \ struct device_attribute *attr, \
char *buf) \ char *buf) \
...@@ -409,14 +409,14 @@ static ssize_t show_sys_acpi(int cm, char *buf) ...@@ -409,14 +409,14 @@ static ssize_t show_sys_acpi(int cm, char *buf)
static struct device_attribute dev_attr_##_name = { \ static struct device_attribute dev_attr_##_name = { \
.attr = { \ .attr = { \
.name = __stringify(_name), \ .name = __stringify(_name), \
.mode = 0644 }, \ .mode = _mode }, \
.show = show_##_name, \ .show = show_##_name, \
.store = store_##_name, \ .store = store_##_name, \
} }
EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); EEEPC_CREATE_DEVICE_ATTR(camera, 0644, CM_ASL_CAMERA);
EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); EEEPC_CREATE_DEVICE_ATTR(cardr, 0644, CM_ASL_CARDREADER);
EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); EEEPC_CREATE_DEVICE_ATTR(disp, 0200, CM_ASL_DISPLAYSWITCH);
struct eeepc_cpufv { struct eeepc_cpufv {
int num; int num;
......
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