.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for Linear Technology LTC4151 High Voltage I2C Current |
---|
3 | 4 | * and Voltage Monitor |
---|
.. | .. |
---|
11 | 12 | * Copyright (C) 2010 Ericsson AB. |
---|
12 | 13 | * |
---|
13 | 14 | * 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 | | - * |
---|
29 | 15 | */ |
---|
30 | 16 | |
---|
31 | 17 | #include <linux/kernel.h> |
---|
.. | .. |
---|
131 | 117 | return val; |
---|
132 | 118 | } |
---|
133 | 119 | |
---|
134 | | -static ssize_t ltc4151_show_value(struct device *dev, |
---|
| 120 | +static ssize_t ltc4151_value_show(struct device *dev, |
---|
135 | 121 | struct device_attribute *da, char *buf) |
---|
136 | 122 | { |
---|
137 | 123 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
---|
.. | .. |
---|
148 | 134 | /* |
---|
149 | 135 | * Input voltages. |
---|
150 | 136 | */ |
---|
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); |
---|
155 | 139 | |
---|
156 | 140 | /* 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); |
---|
159 | 142 | |
---|
160 | 143 | /* |
---|
161 | 144 | * Finally, construct an array of pointers to members of the above objects, |
---|
.. | .. |
---|
171 | 154 | }; |
---|
172 | 155 | ATTRIBUTE_GROUPS(ltc4151); |
---|
173 | 156 | |
---|
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) |
---|
176 | 158 | { |
---|
177 | 159 | struct i2c_adapter *adapter = client->adapter; |
---|
178 | 160 | struct device *dev = &client->dev; |
---|
.. | .. |
---|
211 | 193 | }; |
---|
212 | 194 | MODULE_DEVICE_TABLE(i2c, ltc4151_id); |
---|
213 | 195 | |
---|
214 | | -static const struct of_device_id ltc4151_match[] = { |
---|
| 196 | +static const struct of_device_id __maybe_unused ltc4151_match[] = { |
---|
215 | 197 | { .compatible = "lltc,ltc4151" }, |
---|
216 | 198 | {}, |
---|
217 | 199 | }; |
---|
.. | .. |
---|
223 | 205 | .name = "ltc4151", |
---|
224 | 206 | .of_match_table = of_match_ptr(ltc4151_match), |
---|
225 | 207 | }, |
---|
226 | | - .probe = ltc4151_probe, |
---|
| 208 | + .probe_new = ltc4151_probe, |
---|
227 | 209 | .id_table = ltc4151_id, |
---|
228 | 210 | }; |
---|
229 | 211 | |
---|