diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2018-12-10 17:02:23 -0500 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2019-02-18 17:23:29 -0500 |
| commit | fa75f745e34a641f49f88b83eed72b0ae383eaa6 (patch) | |
| tree | ac75b052ecae65ed415da33030d58d45d2d6e542 /drivers/hwmon | |
| parent | b626eb22f9e17fcca4e262a8274e93690068557f (diff) | |
hwmon: (vexpress-hwmon) 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.
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
| -rw-r--r-- | drivers/hwmon/vexpress-hwmon.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/hwmon/vexpress-hwmon.c b/drivers/hwmon/vexpress-hwmon.c index 8ba419d343f8..0b84adb5e88e 100644 --- a/drivers/hwmon/vexpress-hwmon.c +++ b/drivers/hwmon/vexpress-hwmon.c | |||
| @@ -92,9 +92,8 @@ struct vexpress_hwmon_type { | |||
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | #if !defined(CONFIG_REGULATOR_VEXPRESS) | 94 | #if !defined(CONFIG_REGULATOR_VEXPRESS) |
| 95 | static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 95 | static DEVICE_ATTR(in1_label, 0444, vexpress_hwmon_label_show, NULL); |
| 96 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show, | 96 | static SENSOR_DEVICE_ATTR_RO(in1_input, vexpress_hwmon_u32, 1000); |
| 97 | NULL, 1000); | ||
| 98 | static struct attribute *vexpress_hwmon_attrs_volt[] = { | 97 | static struct attribute *vexpress_hwmon_attrs_volt[] = { |
| 99 | &dev_attr_in1_label.attr, | 98 | &dev_attr_in1_label.attr, |
| 100 | &sensor_dev_attr_in1_input.dev_attr.attr, | 99 | &sensor_dev_attr_in1_input.dev_attr.attr, |
| @@ -113,9 +112,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_volt = { | |||
| 113 | }; | 112 | }; |
| 114 | #endif | 113 | #endif |
| 115 | 114 | ||
| 116 | static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 115 | static DEVICE_ATTR(curr1_label, 0444, vexpress_hwmon_label_show, NULL); |
| 117 | static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, vexpress_hwmon_u32_show, | 116 | static SENSOR_DEVICE_ATTR_RO(curr1_input, vexpress_hwmon_u32, 1000); |
| 118 | NULL, 1000); | ||
| 119 | static struct attribute *vexpress_hwmon_attrs_amp[] = { | 117 | static struct attribute *vexpress_hwmon_attrs_amp[] = { |
| 120 | &dev_attr_curr1_label.attr, | 118 | &dev_attr_curr1_label.attr, |
| 121 | &sensor_dev_attr_curr1_input.dev_attr.attr, | 119 | &sensor_dev_attr_curr1_input.dev_attr.attr, |
| @@ -133,9 +131,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_amp = { | |||
| 133 | }, | 131 | }, |
| 134 | }; | 132 | }; |
| 135 | 133 | ||
| 136 | static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 134 | static DEVICE_ATTR(temp1_label, 0444, vexpress_hwmon_label_show, NULL); |
| 137 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show, | 135 | static SENSOR_DEVICE_ATTR_RO(temp1_input, vexpress_hwmon_u32, 1000); |
| 138 | NULL, 1000); | ||
| 139 | static struct attribute *vexpress_hwmon_attrs_temp[] = { | 136 | static struct attribute *vexpress_hwmon_attrs_temp[] = { |
| 140 | &dev_attr_temp1_label.attr, | 137 | &dev_attr_temp1_label.attr, |
| 141 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 138 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
| @@ -153,9 +150,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_temp = { | |||
| 153 | }, | 150 | }, |
| 154 | }; | 151 | }; |
| 155 | 152 | ||
| 156 | static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 153 | static DEVICE_ATTR(power1_label, 0444, vexpress_hwmon_label_show, NULL); |
| 157 | static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show, | 154 | static SENSOR_DEVICE_ATTR_RO(power1_input, vexpress_hwmon_u32, 1); |
| 158 | NULL, 1); | ||
| 159 | static struct attribute *vexpress_hwmon_attrs_power[] = { | 155 | static struct attribute *vexpress_hwmon_attrs_power[] = { |
| 160 | &dev_attr_power1_label.attr, | 156 | &dev_attr_power1_label.attr, |
| 161 | &sensor_dev_attr_power1_input.dev_attr.attr, | 157 | &sensor_dev_attr_power1_input.dev_attr.attr, |
| @@ -173,9 +169,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_power = { | |||
| 173 | }, | 169 | }, |
| 174 | }; | 170 | }; |
| 175 | 171 | ||
| 176 | static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 172 | static DEVICE_ATTR(energy1_label, 0444, vexpress_hwmon_label_show, NULL); |
| 177 | static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show, | 173 | static SENSOR_DEVICE_ATTR_RO(energy1_input, vexpress_hwmon_u64, 1); |
| 178 | NULL, 1); | ||
| 179 | static struct attribute *vexpress_hwmon_attrs_energy[] = { | 174 | static struct attribute *vexpress_hwmon_attrs_energy[] = { |
| 180 | &dev_attr_energy1_label.attr, | 175 | &dev_attr_energy1_label.attr, |
| 181 | &sensor_dev_attr_energy1_input.dev_attr.attr, | 176 | &sensor_dev_attr_energy1_input.dev_attr.attr, |
