.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * ds620.c - Support for temperature sensor and thermostat DS620 |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2010, 2011 Roland Stigge <stigge@antcom.de> |
---|
5 | 6 | * |
---|
6 | 7 | * based on ds1621.c by Christian W. Zuckschwerdt <zany@triq.net> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
11 | | - * (at your option) any later version. |
---|
12 | | - * |
---|
13 | | - * This program is distributed in the hope that it will be useful, |
---|
14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | | - * GNU General Public License for more details. |
---|
17 | | - * |
---|
18 | | - * You should have received a copy of the GNU General Public License |
---|
19 | | - * along with this program; if not, write to the Free Software |
---|
20 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
21 | 8 | */ |
---|
22 | 9 | |
---|
23 | 10 | #include <linux/module.h> |
---|
.. | .. |
---|
139 | 126 | return ret; |
---|
140 | 127 | } |
---|
141 | 128 | |
---|
142 | | -static ssize_t show_temp(struct device *dev, struct device_attribute *da, |
---|
| 129 | +static ssize_t temp_show(struct device *dev, struct device_attribute *da, |
---|
143 | 130 | char *buf) |
---|
144 | 131 | { |
---|
145 | 132 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
---|
.. | .. |
---|
151 | 138 | return sprintf(buf, "%d\n", ((data->temp[attr->index] / 8) * 625) / 10); |
---|
152 | 139 | } |
---|
153 | 140 | |
---|
154 | | -static ssize_t set_temp(struct device *dev, struct device_attribute *da, |
---|
155 | | - const char *buf, size_t count) |
---|
| 141 | +static ssize_t temp_store(struct device *dev, struct device_attribute *da, |
---|
| 142 | + const char *buf, size_t count) |
---|
156 | 143 | { |
---|
157 | 144 | int res; |
---|
158 | 145 | long val; |
---|
.. | .. |
---|
176 | 163 | return count; |
---|
177 | 164 | } |
---|
178 | 165 | |
---|
179 | | -static ssize_t show_alarm(struct device *dev, struct device_attribute *da, |
---|
| 166 | +static ssize_t alarm_show(struct device *dev, struct device_attribute *da, |
---|
180 | 167 | char *buf) |
---|
181 | 168 | { |
---|
182 | 169 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
---|
.. | .. |
---|
207 | 194 | return sprintf(buf, "%d\n", !!(conf & attr->index)); |
---|
208 | 195 | } |
---|
209 | 196 | |
---|
210 | | -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); |
---|
211 | | -static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, 1); |
---|
212 | | -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, 2); |
---|
213 | | -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, |
---|
214 | | - DS620_REG_CONFIG_TLF); |
---|
215 | | -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, |
---|
216 | | - DS620_REG_CONFIG_THF); |
---|
| 197 | +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0); |
---|
| 198 | +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, 1); |
---|
| 199 | +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, 2); |
---|
| 200 | +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, DS620_REG_CONFIG_TLF); |
---|
| 201 | +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, DS620_REG_CONFIG_THF); |
---|
217 | 202 | |
---|
218 | 203 | static struct attribute *ds620_attrs[] = { |
---|
219 | 204 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
---|
.. | .. |
---|
226 | 211 | |
---|
227 | 212 | ATTRIBUTE_GROUPS(ds620); |
---|
228 | 213 | |
---|
229 | | -static int ds620_probe(struct i2c_client *client, |
---|
230 | | - const struct i2c_device_id *id) |
---|
| 214 | +static int ds620_probe(struct i2c_client *client) |
---|
231 | 215 | { |
---|
232 | 216 | struct device *dev = &client->dev; |
---|
233 | 217 | struct device *hwmon_dev; |
---|
.. | .. |
---|
261 | 245 | .driver = { |
---|
262 | 246 | .name = "ds620", |
---|
263 | 247 | }, |
---|
264 | | - .probe = ds620_probe, |
---|
| 248 | + .probe_new = ds620_probe, |
---|
265 | 249 | .id_table = ds620_id, |
---|
266 | 250 | }; |
---|
267 | 251 | |
---|