.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* Sensirion SHT21 humidity and temperature sensor driver |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright (C) 2010 Urs Fleisch <urs.fleisch@sensirion.com> |
---|
4 | 5 | * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License as published by |
---|
7 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
8 | | - * (at your option) any later version. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | | - * |
---|
15 | | - * You should have received a copy of the GNU General Public License |
---|
16 | | - * along with this program; if not, write to the Free Software |
---|
17 | | - * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA |
---|
18 | | - * |
---|
19 | | - * Data sheet available at http://www.sensirion.com/file/datasheet_sht21 |
---|
| 6 | + * Data sheet available at https://www.sensirion.com/file/datasheet_sht21 |
---|
20 | 7 | */ |
---|
21 | 8 | |
---|
22 | 9 | #include <linux/module.h> |
---|
.. | .. |
---|
135 | 122 | * Will be called on read access to temp1_input sysfs attribute. |
---|
136 | 123 | * Returns number of bytes written into buffer, negative errno on error. |
---|
137 | 124 | */ |
---|
138 | | -static ssize_t sht21_show_temperature(struct device *dev, |
---|
139 | | - struct device_attribute *attr, |
---|
140 | | - char *buf) |
---|
| 125 | +static ssize_t sht21_temperature_show(struct device *dev, |
---|
| 126 | + struct device_attribute *attr, |
---|
| 127 | + char *buf) |
---|
141 | 128 | { |
---|
142 | 129 | struct sht21 *sht21 = dev_get_drvdata(dev); |
---|
143 | 130 | int ret; |
---|
.. | .. |
---|
157 | 144 | * Will be called on read access to humidity1_input sysfs attribute. |
---|
158 | 145 | * Returns number of bytes written into buffer, negative errno on error. |
---|
159 | 146 | */ |
---|
160 | | -static ssize_t sht21_show_humidity(struct device *dev, |
---|
161 | | - struct device_attribute *attr, |
---|
162 | | - char *buf) |
---|
| 147 | +static ssize_t sht21_humidity_show(struct device *dev, |
---|
| 148 | + struct device_attribute *attr, char *buf) |
---|
163 | 149 | { |
---|
164 | 150 | struct sht21 *sht21 = dev_get_drvdata(dev); |
---|
165 | 151 | int ret; |
---|
.. | .. |
---|
251 | 237 | } |
---|
252 | 238 | |
---|
253 | 239 | /* sysfs attributes */ |
---|
254 | | -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, sht21_show_temperature, |
---|
255 | | - NULL, 0); |
---|
256 | | -static SENSOR_DEVICE_ATTR(humidity1_input, S_IRUGO, sht21_show_humidity, |
---|
257 | | - NULL, 0); |
---|
| 240 | +static SENSOR_DEVICE_ATTR_RO(temp1_input, sht21_temperature, 0); |
---|
| 241 | +static SENSOR_DEVICE_ATTR_RO(humidity1_input, sht21_humidity, 0); |
---|
258 | 242 | static DEVICE_ATTR_RO(eic); |
---|
259 | 243 | |
---|
260 | 244 | static struct attribute *sht21_attrs[] = { |
---|
.. | .. |
---|
266 | 250 | |
---|
267 | 251 | ATTRIBUTE_GROUPS(sht21); |
---|
268 | 252 | |
---|
269 | | -static int sht21_probe(struct i2c_client *client, |
---|
270 | | - const struct i2c_device_id *id) |
---|
| 253 | +static int sht21_probe(struct i2c_client *client) |
---|
271 | 254 | { |
---|
272 | 255 | struct device *dev = &client->dev; |
---|
273 | 256 | struct device *hwmon_dev; |
---|
.. | .. |
---|
302 | 285 | |
---|
303 | 286 | static struct i2c_driver sht21_driver = { |
---|
304 | 287 | .driver.name = "sht21", |
---|
305 | | - .probe = sht21_probe, |
---|
| 288 | + .probe_new = sht21_probe, |
---|
306 | 289 | .id_table = sht21_id, |
---|
307 | 290 | }; |
---|
308 | 291 | |
---|