aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2013-05-22 06:31:59 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-17 19:02:33 -0400
commitea9dd9d655adf16b083b79ad84e5b012543f659f (patch)
tree1f39bf1ed34b75e404fc96ad2fe1847aeec294ee /drivers/extcon
parent12e50c30545b74ca8b6ef7f442b826fed155193f (diff)
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>
Diffstat (limited to 'drivers/extcon')
-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,
185 cable->cable_index)); 185 cable->cable_index));
186} 186}
187 187
188static ssize_t cable_state_store(struct device *dev,
189 struct device_attribute *attr, const char *buf,
190 size_t count)
191{
192 struct extcon_cable *cable = container_of(attr, struct extcon_cable,
193 attr_state);
194 int ret, state;
195
196 ret = sscanf(buf, "%d", &state);
197 if (ret == 0)
198 ret = -EINVAL;
199 else
200 ret = extcon_set_cable_state_(cable->edev, cable->cable_index,
201 state);
202
203 if (ret < 0)
204 return ret;
205 return count;
206}
207
208/** 188/**
209 * extcon_update_state() - Update the cable attach states of the extcon device 189 * extcon_update_state() - Update the cable attach states of the extcon device
210 * only for the masked bits. 190 * only for the masked bits.
@@ -665,9 +645,8 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
665 645
666 sysfs_attr_init(&cable->attr_state.attr); 646 sysfs_attr_init(&cable->attr_state.attr);
667 cable->attr_state.attr.name = "state"; 647 cable->attr_state.attr.name = "state";
668 cable->attr_state.attr.mode = 0644; 648 cable->attr_state.attr.mode = 0444;
669 cable->attr_state.show = cable_state_show; 649 cable->attr_state.show = cable_state_show;
670 cable->attr_state.store = cable_state_store;
671 } 650 }
672 } 651 }
673 652