diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-01-10 13:30:31 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-04-08 00:16:40 -0400 |
commit | b5f0f1eadf14d7afad8c8c7aadee7527082efaac (patch) | |
tree | 8c2d440b9daaad0f905b7c7e0043f5a10e2f6d53 /drivers/hwmon/ltc4215.c | |
parent | bc0c591ec1d1f5dd0549c0f0d003647d197a025b (diff) |
hwmon: (ltc4215) Fix 'Macros with complex values' checkpatch error
Fix:
ERROR: Macros with complex values should be enclosed in parenthesis
by unwinding the problematic macros.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/ltc4215.c')
-rw-r--r-- | drivers/hwmon/ltc4215.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/drivers/hwmon/ltc4215.c b/drivers/hwmon/ltc4215.c index e8876108a6b3..8a142960d69e 100644 --- a/drivers/hwmon/ltc4215.c +++ b/drivers/hwmon/ltc4215.c | |||
@@ -172,12 +172,12 @@ static ssize_t ltc4215_show_alarm(struct device *dev, | |||
172 | struct device_attribute *da, | 172 | struct device_attribute *da, |
173 | char *buf) | 173 | char *buf) |
174 | { | 174 | { |
175 | struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(da); | 175 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
176 | struct ltc4215_data *data = ltc4215_update_device(dev); | 176 | struct ltc4215_data *data = ltc4215_update_device(dev); |
177 | const u8 reg = data->regs[attr->index]; | 177 | const u8 reg = data->regs[LTC4215_STATUS]; |
178 | const u32 mask = attr->nr; | 178 | const u32 mask = attr->index; |
179 | 179 | ||
180 | return snprintf(buf, PAGE_SIZE, "%u\n", (reg & mask) ? 1 : 0); | 180 | return snprintf(buf, PAGE_SIZE, "%u\n", !!(reg & mask)); |
181 | } | 181 | } |
182 | 182 | ||
183 | /* | 183 | /* |
@@ -186,39 +186,29 @@ static ssize_t ltc4215_show_alarm(struct device *dev, | |||
186 | * for each register. | 186 | * for each register. |
187 | */ | 187 | */ |
188 | 188 | ||
189 | #define LTC4215_VOLTAGE(name, ltc4215_cmd_idx) \ | ||
190 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, \ | ||
191 | ltc4215_show_voltage, NULL, ltc4215_cmd_idx) | ||
192 | |||
193 | #define LTC4215_CURRENT(name) \ | ||
194 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, \ | ||
195 | ltc4215_show_current, NULL, 0); | ||
196 | |||
197 | #define LTC4215_POWER(name) \ | ||
198 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, \ | ||
199 | ltc4215_show_power, NULL, 0); | ||
200 | |||
201 | #define LTC4215_ALARM(name, mask, reg) \ | ||
202 | static SENSOR_DEVICE_ATTR_2(name, S_IRUGO, \ | ||
203 | ltc4215_show_alarm, NULL, (mask), reg) | ||
204 | |||
205 | /* Construct a sensor_device_attribute structure for each register */ | 189 | /* Construct a sensor_device_attribute structure for each register */ |
206 | 190 | ||
207 | /* Current */ | 191 | /* Current */ |
208 | LTC4215_CURRENT(curr1_input); | 192 | static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc4215_show_current, NULL, 0); |
209 | LTC4215_ALARM(curr1_max_alarm, (1 << 2), LTC4215_STATUS); | 193 | static SENSOR_DEVICE_ATTR(curr1_max_alarm, S_IRUGO, ltc4215_show_alarm, NULL, |
194 | 1 << 2); | ||
210 | 195 | ||
211 | /* Power (virtual) */ | 196 | /* Power (virtual) */ |
212 | LTC4215_POWER(power1_input); | 197 | static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, ltc4215_show_power, NULL, 0); |
213 | 198 | ||
214 | /* Input Voltage */ | 199 | /* Input Voltage */ |
215 | LTC4215_VOLTAGE(in1_input, LTC4215_ADIN); | 200 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc4215_show_voltage, NULL, |
216 | LTC4215_ALARM(in1_max_alarm, (1 << 0), LTC4215_STATUS); | 201 | LTC4215_ADIN); |
217 | LTC4215_ALARM(in1_min_alarm, (1 << 1), LTC4215_STATUS); | 202 | static SENSOR_DEVICE_ATTR(in1_max_alarm, S_IRUGO, ltc4215_show_alarm, NULL, |
203 | 1 << 0); | ||
204 | static SENSOR_DEVICE_ATTR(in1_min_alarm, S_IRUGO, ltc4215_show_alarm, NULL, | ||
205 | 1 << 1); | ||
218 | 206 | ||
219 | /* Output Voltage */ | 207 | /* Output Voltage */ |
220 | LTC4215_VOLTAGE(in2_input, LTC4215_SOURCE); | 208 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4215_show_voltage, NULL, |
221 | LTC4215_ALARM(in2_min_alarm, (1 << 3), LTC4215_STATUS); | 209 | LTC4215_SOURCE); |
210 | static SENSOR_DEVICE_ATTR(in2_min_alarm, S_IRUGO, ltc4215_show_alarm, NULL, | ||
211 | 1 << 3); | ||
222 | 212 | ||
223 | /* | 213 | /* |
224 | * Finally, construct an array of pointers to members of the above objects, | 214 | * Finally, construct an array of pointers to members of the above objects, |