Skip to content

Correct the read/write permissions. #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: odroidxu3-3.10.y
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions drivers/hardkernel/ina231-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,40 @@
//
//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_name (struct device *dev, struct device_attribute *attr, char *buf);
static DEVICE_ATTR(sensor_name, S_IRWXUGO, show_name, NULL);
static DEVICE_ATTR(sensor_name, S_IRUGO, show_name, NULL);

//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_power (struct device *dev, struct device_attribute *attr, char *buf);
static DEVICE_ATTR(sensor_W, S_IRWXUGO, show_power, NULL);
static DEVICE_ATTR(sensor_W, S_IRUGO, show_power, NULL);

//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_current (struct device *dev, struct device_attribute *attr, char *buf);
static DEVICE_ATTR(sensor_A, S_IRWXUGO, show_current, NULL);
static DEVICE_ATTR(sensor_A, S_IRUGO, show_current, NULL);

//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_voltage (struct device *dev, struct device_attribute *attr, char *buf);
static DEVICE_ATTR(sensor_V, S_IRWXUGO, show_voltage, NULL);
static DEVICE_ATTR(sensor_V, S_IRUGO, show_voltage, NULL);

//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_max_power (struct device *dev, struct device_attribute *attr, char *buf);
static DEVICE_ATTR(sensor_maxW, S_IRWXUGO, show_max_power, NULL);
static DEVICE_ATTR(sensor_maxW, S_IRUGO, show_max_power, NULL);

//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_max_current (struct device *dev, struct device_attribute *attr, char *buf);
static DEVICE_ATTR(sensor_maxA, S_IRWXUGO, show_max_current, NULL);
static DEVICE_ATTR(sensor_maxA, S_IRUGO, show_max_current, NULL);

//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_max_voltage (struct device *dev, struct device_attribute *attr, char *buf);
static DEVICE_ATTR(sensor_maxV, S_IRWXUGO, show_max_voltage, NULL);
static DEVICE_ATTR(sensor_maxV, S_IRUGO, show_max_voltage, NULL);

//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_enable (struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t set_enable (struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
static DEVICE_ATTR(enable, S_IRWXUGO, show_enable, set_enable);
static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_enable, set_enable);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I make it only write accessible by root as convention. If this is not what you intended you may change it to
DEVICE_ATTR(enable, S_IRUGO | S_IWUGO, show_enable, set_enable); or something else. But anyway there are no reasons to give them execute permission.

//[*]--------------------------------------------------------------------------------------------------[*]
static ssize_t show_period (struct device *dev, struct device_attribute *attr, char *buf);
static DEVICE_ATTR(update_period, S_IRWXUGO, show_period, NULL);
static DEVICE_ATTR(update_period, S_IRUGO, show_period, NULL);

//[*]--------------------------------------------------------------------------------------------------[*]
//[*]--------------------------------------------------------------------------------------------------[*]
Expand Down