Skip to content

Commit

Permalink
extcon: Change permission 'state' sysfs entry (rw -> r)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Myungjoo Ham <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
chanwoochoi authored and gregkh committed Jun 17, 2013
1 parent 12e50c3 commit ea9dd9d
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions drivers/extcon/extcon-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit ea9dd9d

Please sign in to comment.