forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/hwmon/ltc4151.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for Linear Technology LTC4151 High Voltage I2C Current
34 * and Voltage Monitor
....@@ -11,21 +12,6 @@
1112 * Copyright (C) 2010 Ericsson AB.
1213 *
1314 * Datasheet: http://www.linear.com/docs/Datasheet/4151fc.pdf
14
- *
15
- * This program is free software; you can redistribute it and/or modify
16
- * it under the terms of the GNU General Public License as published by
17
- * the Free Software Foundation; either version 2 of the License, or
18
- * (at your option) any later version.
19
- *
20
- * This program is distributed in the hope that it will be useful,
21
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- * GNU General Public License for more details.
24
- *
25
- * You should have received a copy of the GNU General Public License
26
- * along with this program; if not, write to the Free Software
27
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
- *
2915 */
3016
3117 #include <linux/kernel.h>
....@@ -131,7 +117,7 @@
131117 return val;
132118 }
133119
134
-static ssize_t ltc4151_show_value(struct device *dev,
120
+static ssize_t ltc4151_value_show(struct device *dev,
135121 struct device_attribute *da, char *buf)
136122 {
137123 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
....@@ -148,14 +134,11 @@
148134 /*
149135 * Input voltages.
150136 */
151
-static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc4151_show_value, NULL,
152
- LTC4151_VIN_H);
153
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4151_show_value, NULL,
154
- LTC4151_ADIN_H);
137
+static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4151_value, LTC4151_VIN_H);
138
+static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4151_value, LTC4151_ADIN_H);
155139
156140 /* Currents (via sense resistor) */
157
-static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc4151_show_value, NULL,
158
- LTC4151_SENSE_H);
141
+static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4151_value, LTC4151_SENSE_H);
159142
160143 /*
161144 * Finally, construct an array of pointers to members of the above objects,
....@@ -171,8 +154,7 @@
171154 };
172155 ATTRIBUTE_GROUPS(ltc4151);
173156
174
-static int ltc4151_probe(struct i2c_client *client,
175
- const struct i2c_device_id *id)
157
+static int ltc4151_probe(struct i2c_client *client)
176158 {
177159 struct i2c_adapter *adapter = client->adapter;
178160 struct device *dev = &client->dev;
....@@ -211,7 +193,7 @@
211193 };
212194 MODULE_DEVICE_TABLE(i2c, ltc4151_id);
213195
214
-static const struct of_device_id ltc4151_match[] = {
196
+static const struct of_device_id __maybe_unused ltc4151_match[] = {
215197 { .compatible = "lltc,ltc4151" },
216198 {},
217199 };
....@@ -223,7 +205,7 @@
223205 .name = "ltc4151",
224206 .of_match_table = of_match_ptr(ltc4151_match),
225207 },
226
- .probe = ltc4151_probe,
208
+ .probe_new = ltc4151_probe,
227209 .id_table = ltc4151_id,
228210 };
229211