.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Texas Instruments TMP103 SMBus temperature sensor driver |
---|
3 | 4 | * Copyright (C) 2014 Heiko Schocher <hs@denx.de> |
---|
.. | .. |
---|
6 | 7 | * Texas Instruments TMP102 SMBus temperature sensor driver |
---|
7 | 8 | * |
---|
8 | 9 | * Copyright (C) 2010 Steven King <sfking@fdwdc.com> |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify |
---|
11 | | - * it under the terms of the GNU General Public License as published by |
---|
12 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
13 | | - * (at your option) any later version. |
---|
14 | | - * |
---|
15 | | - * This program is distributed in the hope that it will be useful, |
---|
16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | | - * GNU General Public License for more details. |
---|
19 | | - * |
---|
20 | 10 | */ |
---|
21 | 11 | |
---|
22 | 12 | #include <linux/module.h> |
---|
.. | .. |
---|
61 | 51 | return DIV_ROUND_CLOSEST(val, 1000); |
---|
62 | 52 | } |
---|
63 | 53 | |
---|
64 | | -static ssize_t tmp103_show_temp(struct device *dev, |
---|
65 | | - struct device_attribute *attr, |
---|
66 | | - char *buf) |
---|
| 54 | +static ssize_t tmp103_temp_show(struct device *dev, |
---|
| 55 | + struct device_attribute *attr, char *buf) |
---|
67 | 56 | { |
---|
68 | 57 | struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); |
---|
69 | 58 | struct regmap *regmap = dev_get_drvdata(dev); |
---|
.. | .. |
---|
77 | 66 | return sprintf(buf, "%d\n", tmp103_reg_to_mc(regval)); |
---|
78 | 67 | } |
---|
79 | 68 | |
---|
80 | | -static ssize_t tmp103_set_temp(struct device *dev, |
---|
81 | | - struct device_attribute *attr, |
---|
82 | | - const char *buf, size_t count) |
---|
| 69 | +static ssize_t tmp103_temp_store(struct device *dev, |
---|
| 70 | + struct device_attribute *attr, |
---|
| 71 | + const char *buf, size_t count) |
---|
83 | 72 | { |
---|
84 | 73 | struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); |
---|
85 | 74 | struct regmap *regmap = dev_get_drvdata(dev); |
---|
.. | .. |
---|
94 | 83 | return ret ? ret : count; |
---|
95 | 84 | } |
---|
96 | 85 | |
---|
97 | | -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, tmp103_show_temp, NULL , |
---|
98 | | - TMP103_TEMP_REG); |
---|
| 86 | +static SENSOR_DEVICE_ATTR_RO(temp1_input, tmp103_temp, TMP103_TEMP_REG); |
---|
99 | 87 | |
---|
100 | | -static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, tmp103_show_temp, |
---|
101 | | - tmp103_set_temp, TMP103_TLOW_REG); |
---|
| 88 | +static SENSOR_DEVICE_ATTR_RW(temp1_min, tmp103_temp, TMP103_TLOW_REG); |
---|
102 | 89 | |
---|
103 | | -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, tmp103_show_temp, |
---|
104 | | - tmp103_set_temp, TMP103_THIGH_REG); |
---|
| 90 | +static SENSOR_DEVICE_ATTR_RW(temp1_max, tmp103_temp, TMP103_THIGH_REG); |
---|
105 | 91 | |
---|
106 | 92 | static struct attribute *tmp103_attrs[] = { |
---|
107 | 93 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
---|
.. | .. |
---|
123 | 109 | .volatile_reg = tmp103_regmap_is_volatile, |
---|
124 | 110 | }; |
---|
125 | 111 | |
---|
126 | | -static int tmp103_probe(struct i2c_client *client, |
---|
127 | | - const struct i2c_device_id *id) |
---|
| 112 | +static int tmp103_probe(struct i2c_client *client) |
---|
128 | 113 | { |
---|
129 | 114 | struct device *dev = &client->dev; |
---|
130 | 115 | struct device *hwmon_dev; |
---|
.. | .. |
---|
174 | 159 | }; |
---|
175 | 160 | MODULE_DEVICE_TABLE(i2c, tmp103_id); |
---|
176 | 161 | |
---|
177 | | -static const struct of_device_id tmp103_of_match[] = { |
---|
| 162 | +static const struct of_device_id __maybe_unused tmp103_of_match[] = { |
---|
178 | 163 | { .compatible = "ti,tmp103" }, |
---|
179 | 164 | { }, |
---|
180 | 165 | }; |
---|
.. | .. |
---|
186 | 171 | .of_match_table = of_match_ptr(tmp103_of_match), |
---|
187 | 172 | .pm = &tmp103_dev_pm_ops, |
---|
188 | 173 | }, |
---|
189 | | - .probe = tmp103_probe, |
---|
| 174 | + .probe_new = tmp103_probe, |
---|
190 | 175 | .id_table = tmp103_id, |
---|
191 | 176 | }; |
---|
192 | 177 | |
---|