hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/hwmon/ads7871.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ads7871 - driver for TI ADS7871 A/D converter
34 *
45 * Copyright (c) 2010 Paul Thomas <pthomas8589@gmail.com>
5
- *
6
- * This program is distributed in the hope that it will be useful,
7
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
- * GNU General Public License for more details.
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License version 2 or
13
- * later as publishhed by the Free Software Foundation.
146 *
157 * You need to have something like this in struct spi_board_info
168 * {
....@@ -96,8 +88,8 @@
9688 return spi_write(spi, tmp, sizeof(tmp));
9789 }
9890
99
-static ssize_t show_voltage(struct device *dev,
100
- struct device_attribute *da, char *buf)
91
+static ssize_t voltage_show(struct device *dev, struct device_attribute *da,
92
+ char *buf)
10193 {
10294 struct ads7871_data *pdata = dev_get_drvdata(dev);
10395 struct spi_device *spi = pdata->spi;
....@@ -138,14 +130,14 @@
138130 }
139131 }
140132
141
-static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0);
142
-static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1);
143
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);
144
-static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_voltage, NULL, 3);
145
-static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_voltage, NULL, 4);
146
-static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5);
147
-static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6);
148
-static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7);
133
+static SENSOR_DEVICE_ATTR_RO(in0_input, voltage, 0);
134
+static SENSOR_DEVICE_ATTR_RO(in1_input, voltage, 1);
135
+static SENSOR_DEVICE_ATTR_RO(in2_input, voltage, 2);
136
+static SENSOR_DEVICE_ATTR_RO(in3_input, voltage, 3);
137
+static SENSOR_DEVICE_ATTR_RO(in4_input, voltage, 4);
138
+static SENSOR_DEVICE_ATTR_RO(in5_input, voltage, 5);
139
+static SENSOR_DEVICE_ATTR_RO(in6_input, voltage, 6);
140
+static SENSOR_DEVICE_ATTR_RO(in7_input, voltage, 7);
149141
150142 static struct attribute *ads7871_attrs[] = {
151143 &sensor_dev_attr_in0_input.dev_attr.attr,