提交 9bbacbfe 编写于 作者: J Julia Lawall 提交者: Guenter Roeck

hwmon: (w83627ehf) use permission-specific DEVICE_ATTR variants

Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source
code, improves readbility, and reduces the chance of inconsistencies.

The conversion was done automatically using coccinelle. It was validated
by compiling both the old and the new source code and comparing its text,
data, and bss size.
Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 8b2bd7ae
...@@ -1687,14 +1687,14 @@ store_##reg(struct device *dev, struct device_attribute *attr, \ ...@@ -1687,14 +1687,14 @@ store_##reg(struct device *dev, struct device_attribute *attr, \
fan_time_functions(fan_stop_time, FAN_STOP_TIME) fan_time_functions(fan_stop_time, FAN_STOP_TIME)
static ssize_t show_name(struct device *dev, struct device_attribute *attr, static ssize_t name_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct w83627ehf_data *data = dev_get_drvdata(dev); struct w83627ehf_data *data = dev_get_drvdata(dev);
return sprintf(buf, "%s\n", data->name); return sprintf(buf, "%s\n", data->name);
} }
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static DEVICE_ATTR_RO(name);
static struct sensor_device_attribute sda_sf3_arrays_fan4[] = { static struct sensor_device_attribute sda_sf3_arrays_fan4[] = {
SENSOR_ATTR(pwm4_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time, SENSOR_ATTR(pwm4_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time,
...@@ -1754,12 +1754,12 @@ static struct sensor_device_attribute sda_sf3_max_step_arrays[] = { ...@@ -1754,12 +1754,12 @@ static struct sensor_device_attribute sda_sf3_max_step_arrays[] = {
}; };
static ssize_t static ssize_t
show_vid(struct device *dev, struct device_attribute *attr, char *buf) cpu0_vid_show(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct w83627ehf_data *data = dev_get_drvdata(dev); struct w83627ehf_data *data = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
} }
static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); static DEVICE_ATTR_RO(cpu0_vid);
/* Case open detection */ /* Case open detection */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册