hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hwmon/tmp102.c
....@@ -1,16 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Texas Instruments TMP102 SMBus temperature sensor driver
23 *
34 * Copyright (C) 2010 Steven King <sfking@fdwdc.com>
4
- *
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.
145 */
156
167 #include <linux/delay.h>
....@@ -141,38 +132,20 @@
141132
142133 switch (attr) {
143134 case hwmon_temp_input:
144
- return S_IRUGO;
135
+ return 0444;
145136 case hwmon_temp_max_hyst:
146137 case hwmon_temp_max:
147
- return S_IRUGO | S_IWUSR;
138
+ return 0644;
148139 default:
149140 return 0;
150141 }
151142 }
152143
153
-static u32 tmp102_chip_config[] = {
154
- HWMON_C_REGISTER_TZ,
155
- 0
156
-};
157
-
158
-static const struct hwmon_channel_info tmp102_chip = {
159
- .type = hwmon_chip,
160
- .config = tmp102_chip_config,
161
-};
162
-
163
-static u32 tmp102_temp_config[] = {
164
- HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST,
165
- 0
166
-};
167
-
168
-static const struct hwmon_channel_info tmp102_temp = {
169
- .type = hwmon_temp,
170
- .config = tmp102_temp_config,
171
-};
172
-
173144 static const struct hwmon_channel_info *tmp102_info[] = {
174
- &tmp102_chip,
175
- &tmp102_temp,
145
+ HWMON_CHANNEL_INFO(chip,
146
+ HWMON_C_REGISTER_TZ),
147
+ HWMON_CHANNEL_INFO(temp,
148
+ HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST),
176149 NULL
177150 };
178151
....@@ -212,11 +185,11 @@
212185 .volatile_reg = tmp102_is_volatile_reg,
213186 .val_format_endian = REGMAP_ENDIAN_BIG,
214187 .cache_type = REGCACHE_RBTREE,
215
- .use_single_rw = true,
188
+ .use_single_read = true,
189
+ .use_single_write = true,
216190 };
217191
218
-static int tmp102_probe(struct i2c_client *client,
219
- const struct i2c_device_id *id)
192
+static int tmp102_probe(struct i2c_client *client)
220193 {
221194 struct device *dev = &client->dev;
222195 struct device *hwmon_dev;
....@@ -320,7 +293,7 @@
320293 };
321294 MODULE_DEVICE_TABLE(i2c, tmp102_id);
322295
323
-static const struct of_device_id tmp102_of_match[] = {
296
+static const struct of_device_id __maybe_unused tmp102_of_match[] = {
324297 { .compatible = "ti,tmp102" },
325298 { },
326299 };
....@@ -330,7 +303,7 @@
330303 .driver.name = DRIVER_NAME,
331304 .driver.of_match_table = of_match_ptr(tmp102_of_match),
332305 .driver.pm = &tmp102_dev_pm_ops,
333
- .probe = tmp102_probe,
306
+ .probe_new = tmp102_probe,
334307 .id_table = tmp102_id,
335308 };
336309