diff options
author | Guenter Roeck <linux@roeck-us.net> | 2018-12-06 14:07:32 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2018-12-16 18:13:29 -0500 |
commit | d7f2a8f596ba2a8c7b7cc6d7a86f1e419def87b6 (patch) | |
tree | e19b9bf94c8c9b8d75dbfa19c7ff68832323472b /drivers/hwmon/ltc4215.c | |
parent | 6a0f234fb42111545f071971b25e5f8462621a8a (diff) |
hwmon: (ltc4215) Auto-convert to use SENSOR_DEVICE_ATTR_{RO, RW, WO}
Conversion was done done using the coccinelle script at
https://github.com/groeck/coccinelle-patches/raw/master/hwmon/sensor-devattr-w6.cocci
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/ltc4215.c')
-rw-r--r-- | drivers/hwmon/ltc4215.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/hwmon/ltc4215.c b/drivers/hwmon/ltc4215.c index c8a9bd9b050f..d4a1d033d3e8 100644 --- a/drivers/hwmon/ltc4215.c +++ b/drivers/hwmon/ltc4215.c | |||
@@ -136,9 +136,8 @@ static unsigned int ltc4215_get_current(struct device *dev) | |||
136 | return curr; | 136 | return curr; |
137 | } | 137 | } |
138 | 138 | ||
139 | static ssize_t ltc4215_show_voltage(struct device *dev, | 139 | static ssize_t ltc4215_voltage_show(struct device *dev, |
140 | struct device_attribute *da, | 140 | struct device_attribute *da, char *buf) |
141 | char *buf) | ||
142 | { | 141 | { |
143 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 142 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
144 | const int voltage = ltc4215_get_voltage(dev, attr->index); | 143 | const int voltage = ltc4215_get_voltage(dev, attr->index); |
@@ -146,18 +145,16 @@ static ssize_t ltc4215_show_voltage(struct device *dev, | |||
146 | return snprintf(buf, PAGE_SIZE, "%d\n", voltage); | 145 | return snprintf(buf, PAGE_SIZE, "%d\n", voltage); |
147 | } | 146 | } |
148 | 147 | ||
149 | static ssize_t ltc4215_show_current(struct device *dev, | 148 | static ssize_t ltc4215_current_show(struct device *dev, |
150 | struct device_attribute *da, | 149 | struct device_attribute *da, char *buf) |
151 | char *buf) | ||
152 | { | 150 | { |
153 | const unsigned int curr = ltc4215_get_current(dev); | 151 | const unsigned int curr = ltc4215_get_current(dev); |
154 | 152 | ||
155 | return snprintf(buf, PAGE_SIZE, "%u\n", curr); | 153 | return snprintf(buf, PAGE_SIZE, "%u\n", curr); |
156 | } | 154 | } |
157 | 155 | ||
158 | static ssize_t ltc4215_show_power(struct device *dev, | 156 | static ssize_t ltc4215_power_show(struct device *dev, |
159 | struct device_attribute *da, | 157 | struct device_attribute *da, char *buf) |
160 | char *buf) | ||
161 | { | 158 | { |
162 | const unsigned int curr = ltc4215_get_current(dev); | 159 | const unsigned int curr = ltc4215_get_current(dev); |
163 | const int output_voltage = ltc4215_get_voltage(dev, LTC4215_ADIN); | 160 | const int output_voltage = ltc4215_get_voltage(dev, LTC4215_ADIN); |
@@ -168,9 +165,8 @@ static ssize_t ltc4215_show_power(struct device *dev, | |||
168 | return snprintf(buf, PAGE_SIZE, "%u\n", power); | 165 | return snprintf(buf, PAGE_SIZE, "%u\n", power); |
169 | } | 166 | } |
170 | 167 | ||
171 | static ssize_t ltc4215_show_alarm(struct device *dev, | 168 | static ssize_t ltc4215_alarm_show(struct device *dev, |
172 | struct device_attribute *da, | 169 | struct device_attribute *da, char *buf) |
173 | char *buf) | ||
174 | { | 170 | { |
175 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 171 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
176 | struct ltc4215_data *data = ltc4215_update_device(dev); | 172 | struct ltc4215_data *data = ltc4215_update_device(dev); |
@@ -189,26 +185,20 @@ static ssize_t ltc4215_show_alarm(struct device *dev, | |||
189 | /* Construct a sensor_device_attribute structure for each register */ | 185 | /* Construct a sensor_device_attribute structure for each register */ |
190 | 186 | ||
191 | /* Current */ | 187 | /* Current */ |
192 | static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc4215_show_current, NULL, 0); | 188 | static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4215_current, 0); |
193 | static SENSOR_DEVICE_ATTR(curr1_max_alarm, S_IRUGO, ltc4215_show_alarm, NULL, | 189 | static SENSOR_DEVICE_ATTR_RO(curr1_max_alarm, ltc4215_alarm, 1 << 2); |
194 | 1 << 2); | ||
195 | 190 | ||
196 | /* Power (virtual) */ | 191 | /* Power (virtual) */ |
197 | static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, ltc4215_show_power, NULL, 0); | 192 | static SENSOR_DEVICE_ATTR_RO(power1_input, ltc4215_power, 0); |
198 | 193 | ||
199 | /* Input Voltage */ | 194 | /* Input Voltage */ |
200 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc4215_show_voltage, NULL, | 195 | static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4215_voltage, LTC4215_ADIN); |
201 | LTC4215_ADIN); | 196 | static SENSOR_DEVICE_ATTR_RO(in1_max_alarm, ltc4215_alarm, 1 << 0); |
202 | static SENSOR_DEVICE_ATTR(in1_max_alarm, S_IRUGO, ltc4215_show_alarm, NULL, | 197 | static SENSOR_DEVICE_ATTR_RO(in1_min_alarm, ltc4215_alarm, 1 << 1); |
203 | 1 << 0); | ||
204 | static SENSOR_DEVICE_ATTR(in1_min_alarm, S_IRUGO, ltc4215_show_alarm, NULL, | ||
205 | 1 << 1); | ||
206 | 198 | ||
207 | /* Output Voltage */ | 199 | /* Output Voltage */ |
208 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4215_show_voltage, NULL, | 200 | static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4215_voltage, LTC4215_SOURCE); |
209 | LTC4215_SOURCE); | 201 | static SENSOR_DEVICE_ATTR_RO(in2_min_alarm, ltc4215_alarm, 1 << 3); |
210 | static SENSOR_DEVICE_ATTR(in2_min_alarm, S_IRUGO, ltc4215_show_alarm, NULL, | ||
211 | 1 << 3); | ||
212 | 202 | ||
213 | /* | 203 | /* |
214 | * Finally, construct an array of pointers to members of the above objects, | 204 | * Finally, construct an array of pointers to members of the above objects, |