summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2013-05-22 19:31:59 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-17 16:02:33 -0700
commitea9dd9d655adf16b083b79ad84e5b012543f659f (patch)
tree1f39bf1ed34b75e404fc96ad2fe1847aeec294ee
parent12e50c30545b74ca8b6ef7f442b826fed155193f (diff)
downloadlinux-ea9dd9d655adf16b083b79ad84e5b012543f659f.tar.bz2
extcon: Change permission 'state' sysfs entry (rw -> r)
This patch change permission from read/write to only read. The specific process in the user-space couldn't change the state of cable when cable is attached or detached. - /sys/class/extcon/[devine name]/state Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/extcon/extcon-class.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 60adc04b0561..a5a03ae069ee 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -185,26 +185,6 @@ static ssize_t cable_state_show(struct device *dev,
cable->cable_index));
}
-static ssize_t cable_state_store(struct device *dev,
- struct device_attribute *attr, const char *buf,
- size_t count)
-{
- struct extcon_cable *cable = container_of(attr, struct extcon_cable,
- attr_state);
- int ret, state;
-
- ret = sscanf(buf, "%d", &state);
- if (ret == 0)
- ret = -EINVAL;
- else
- ret = extcon_set_cable_state_(cable->edev, cable->cable_index,
- state);
-
- if (ret < 0)
- return ret;
- return count;
-}
-
/**
* extcon_update_state() - Update the cable attach states of the extcon device
* only for the masked bits.
@@ -665,9 +645,8 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
sysfs_attr_init(&cable->attr_state.attr);
cable->attr_state.attr.name = "state";
- cable->attr_state.attr.mode = 0644;
+ cable->attr_state.attr.mode = 0444;
cable->attr_state.show = cable_state_show;
- cable->attr_state.store = cable_state_store;
}
}