hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hwmon/da9055-hwmon.c
....@@ -1,15 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * HWMON Driver for Dialog DA9055
34 *
45 * Copyright(c) 2012 Dialog Semiconductor Ltd.
56 *
67 * Author: David Dajun Chen <dchen@diasemi.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of the GNU General Public License as published by the
10
- * Free Software Foundation; either version 2 of the License, or (at your
11
- * option) any later version.
12
- *
138 */
149
1510 #include <linux/delay.h>
....@@ -140,8 +135,9 @@
140135 return da9055_reg_update(da9055, DA9055_REG_ADC_CONT, 1 << channel, 0);
141136 }
142137
143
-static ssize_t da9055_read_auto_ch(struct device *dev,
144
- struct device_attribute *devattr, char *buf)
138
+static ssize_t da9055_auto_ch_show(struct device *dev,
139
+ struct device_attribute *devattr,
140
+ char *buf)
145141 {
146142 struct da9055_hwmon *hwmon = dev_get_drvdata(dev);
147143 int ret, adc;
....@@ -176,7 +172,7 @@
176172 return ret;
177173 }
178174
179
-static ssize_t da9055_read_tjunc(struct device *dev,
175
+static ssize_t da9055_tjunc_show(struct device *dev,
180176 struct device_attribute *devattr, char *buf)
181177 {
182178 struct da9055_hwmon *hwmon = dev_get_drvdata(dev);
....@@ -199,34 +195,24 @@
199195 + 3076332, 10000));
200196 }
201197
202
-static ssize_t show_label(struct device *dev,
198
+static ssize_t label_show(struct device *dev,
203199 struct device_attribute *devattr, char *buf)
204200 {
205201 return sprintf(buf, "%s\n",
206202 input_names[to_sensor_dev_attr(devattr)->index]);
207203 }
208204
209
-static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, da9055_read_auto_ch, NULL,
210
- DA9055_ADC_VSYS);
211
-static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL,
212
- DA9055_ADC_VSYS);
213
-static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, da9055_read_auto_ch, NULL,
214
- DA9055_ADC_ADCIN1);
215
-static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL,
216
- DA9055_ADC_ADCIN1);
217
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, da9055_read_auto_ch, NULL,
218
- DA9055_ADC_ADCIN2);
219
-static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL,
220
- DA9055_ADC_ADCIN2);
221
-static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, da9055_read_auto_ch, NULL,
222
- DA9055_ADC_ADCIN3);
223
-static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL,
224
- DA9055_ADC_ADCIN3);
205
+static SENSOR_DEVICE_ATTR_RO(in0_input, da9055_auto_ch, DA9055_ADC_VSYS);
206
+static SENSOR_DEVICE_ATTR_RO(in0_label, label, DA9055_ADC_VSYS);
207
+static SENSOR_DEVICE_ATTR_RO(in1_input, da9055_auto_ch, DA9055_ADC_ADCIN1);
208
+static SENSOR_DEVICE_ATTR_RO(in1_label, label, DA9055_ADC_ADCIN1);
209
+static SENSOR_DEVICE_ATTR_RO(in2_input, da9055_auto_ch, DA9055_ADC_ADCIN2);
210
+static SENSOR_DEVICE_ATTR_RO(in2_label, label, DA9055_ADC_ADCIN2);
211
+static SENSOR_DEVICE_ATTR_RO(in3_input, da9055_auto_ch, DA9055_ADC_ADCIN3);
212
+static SENSOR_DEVICE_ATTR_RO(in3_label, label, DA9055_ADC_ADCIN3);
225213
226
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, da9055_read_tjunc, NULL,
227
- DA9055_ADC_TJUNC);
228
-static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL,
229
- DA9055_ADC_TJUNC);
214
+static SENSOR_DEVICE_ATTR_RO(temp1_input, da9055_tjunc, DA9055_ADC_TJUNC);
215
+static SENSOR_DEVICE_ATTR_RO(temp1_label, label, DA9055_ADC_TJUNC);
230216
231217 static struct attribute *da9055_attrs[] = {
232218 &sensor_dev_attr_in0_input.dev_attr.attr,