diff options
author | Guenter Roeck <linux@roeck-us.net> | 2018-12-10 14:02:09 -0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-02-18 14:23:29 -0800 |
commit | 09cb4161b8745ff15c93ee496db5848e805630c2 (patch) | |
tree | 80b1c9edee92ba7ef1c62445d1247e2c5fb94f5b /drivers/hwmon/ibmpex.c | |
parent | f6861c0eea3da6093c8576fe0d51c62f4168bec6 (diff) | |
download | linux-09cb4161b8745ff15c93ee496db5848e805630c2.tar.bz2 |
hwmon: (ibmpex) Use permission specific SENSOR[_DEVICE]_ATTR variants
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readability, and to reduce the chance of inconsistencies.
Also replace any remaining S_<PERMS> in the driver with octal values.
The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/hwmon/.
This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/ibmpex.c')
-rw-r--r-- | drivers/hwmon/ibmpex.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c index bb17a29af64c..5fd70faf0d16 100644 --- a/drivers/hwmon/ibmpex.c +++ b/drivers/hwmon/ibmpex.c @@ -269,12 +269,12 @@ static struct ibmpex_bmc_data *get_bmc_data(int iface) return NULL; } -static ssize_t show_name(struct device *dev, struct device_attribute *devattr, +static ssize_t name_show(struct device *dev, struct device_attribute *devattr, char *buf) { return sprintf(buf, "%s\n", DRVNAME); } -static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); +static SENSOR_DEVICE_ATTR_RO(name, name, 0); static ssize_t ibmpex_show_sensor(struct device *dev, struct device_attribute *devattr, @@ -289,10 +289,9 @@ static ssize_t ibmpex_show_sensor(struct device *dev, data->sensors[attr->index].values[attr->nr] * mult); } -static ssize_t ibmpex_reset_high_low(struct device *dev, +static ssize_t ibmpex_high_low_store(struct device *dev, struct device_attribute *devattr, - const char *buf, - size_t count) + const char *buf, size_t count) { struct ibmpex_bmc_data *data = dev_get_drvdata(dev); @@ -301,8 +300,7 @@ static ssize_t ibmpex_reset_high_low(struct device *dev, return count; } -static SENSOR_DEVICE_ATTR(reset_high_low, S_IWUSR, NULL, - ibmpex_reset_high_low, 0); +static SENSOR_DEVICE_ATTR_WO(reset_high_low, ibmpex_high_low, 0); static int is_power_sensor(const char *sensor_id, int len) { @@ -358,7 +356,7 @@ static int create_sensor(struct ibmpex_bmc_data *data, int type, sysfs_attr_init(&data->sensors[sensor].attr[func].dev_attr.attr); data->sensors[sensor].attr[func].dev_attr.attr.name = n; - data->sensors[sensor].attr[func].dev_attr.attr.mode = S_IRUGO; + data->sensors[sensor].attr[func].dev_attr.attr.mode = 0444; data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor; data->sensors[sensor].attr[func].index = sensor; data->sensors[sensor].attr[func].nr = func; |