forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/hwmon/sht21.c
....@@ -1,22 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Sensirion SHT21 humidity and temperature sensor driver
23 *
34 * Copyright (C) 2010 Urs Fleisch <urs.fleisch@sensirion.com>
45 *
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
207 */
218
229 #include <linux/module.h>
....@@ -135,9 +122,9 @@
135122 * Will be called on read access to temp1_input sysfs attribute.
136123 * Returns number of bytes written into buffer, negative errno on error.
137124 */
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)
141128 {
142129 struct sht21 *sht21 = dev_get_drvdata(dev);
143130 int ret;
....@@ -157,9 +144,8 @@
157144 * Will be called on read access to humidity1_input sysfs attribute.
158145 * Returns number of bytes written into buffer, negative errno on error.
159146 */
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)
163149 {
164150 struct sht21 *sht21 = dev_get_drvdata(dev);
165151 int ret;
....@@ -251,10 +237,8 @@
251237 }
252238
253239 /* 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);
258242 static DEVICE_ATTR_RO(eic);
259243
260244 static struct attribute *sht21_attrs[] = {
....@@ -266,8 +250,7 @@
266250
267251 ATTRIBUTE_GROUPS(sht21);
268252
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)
271254 {
272255 struct device *dev = &client->dev;
273256 struct device *hwmon_dev;
....@@ -302,7 +285,7 @@
302285
303286 static struct i2c_driver sht21_driver = {
304287 .driver.name = "sht21",
305
- .probe = sht21_probe,
288
+ .probe_new = sht21_probe,
306289 .id_table = sht21_id,
307290 };
308291