hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hwmon/mc13783-adc.c
....@@ -1,21 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /*
23 * Driver for the ADC on Freescale Semiconductor MC13783 and MC13892 PMICs.
34 *
45 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
56 * Copyright (C) 2009 Sascha Hauer, Pengutronix
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version 2
10
- * of the License, or (at your option) any later version.
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along with
17
- * this program; if not, write to the Free Software Foundation, Inc., 51
18
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
197 */
208
219 #include <linux/mfd/mc13xxx.h>
....@@ -75,8 +63,9 @@
7563 return 0;
7664 }
7765
78
-static ssize_t mc13783_adc_read_bp(struct device *dev,
79
- struct device_attribute *devattr, char *buf)
66
+static ssize_t mc13783_adc_bp_show(struct device *dev,
67
+ struct device_attribute *devattr,
68
+ char *buf)
8069 {
8170 unsigned val;
8271 struct platform_device *pdev = to_platform_device(dev);
....@@ -98,8 +87,9 @@
9887 return sprintf(buf, "%u\n", val);
9988 }
10089
101
-static ssize_t mc13783_adc_read_gp(struct device *dev,
102
- struct device_attribute *devattr, char *buf)
90
+static ssize_t mc13783_adc_gp_show(struct device *dev,
91
+ struct device_attribute *devattr,
92
+ char *buf)
10393 {
10494 unsigned val;
10595 int ret = mc13783_adc_read(dev, devattr, &val);
....@@ -116,8 +106,9 @@
116106 return sprintf(buf, "%u\n", val);
117107 }
118108
119
-static ssize_t mc13783_adc_read_uid(struct device *dev,
120
- struct device_attribute *devattr, char *buf)
109
+static ssize_t mc13783_adc_uid_show(struct device *dev,
110
+ struct device_attribute *devattr,
111
+ char *buf)
121112 {
122113 unsigned int val;
123114 struct platform_device *pdev = to_platform_device(dev);
....@@ -137,8 +128,9 @@
137128 return sprintf(buf, "%u\n", val);
138129 }
139130
140
-static ssize_t mc13783_adc_read_temp(struct device *dev,
141
- struct device_attribute *devattr, char *buf)
131
+static ssize_t mc13783_adc_temp_show(struct device *dev,
132
+ struct device_attribute *devattr,
133
+ char *buf)
142134 {
143135 unsigned int val;
144136 struct platform_device *pdev = to_platform_device(dev);
....@@ -168,21 +160,20 @@
168160 }
169161
170162 static DEVICE_ATTR_RO(name);
171
-static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, mc13783_adc_read_bp, NULL, 2);
172
-static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, mc13783_adc_read_gp, NULL, 5);
173
-static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, mc13783_adc_read_gp, NULL, 6);
174
-static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, mc13783_adc_read_gp, NULL, 7);
175
-static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, mc13783_adc_read_gp, NULL, 8);
176
-static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, mc13783_adc_read_gp, NULL, 9);
177
-static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, mc13783_adc_read_gp, NULL, 10);
178
-static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, mc13783_adc_read_gp, NULL, 11);
179
-static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, mc13783_adc_read_gp, NULL, 12);
180
-static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, mc13783_adc_read_gp, NULL, 13);
181
-static SENSOR_DEVICE_ATTR(in14_input, S_IRUGO, mc13783_adc_read_gp, NULL, 14);
182
-static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, mc13783_adc_read_gp, NULL, 15);
183
-static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, mc13783_adc_read_uid, NULL, 16);
184
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
185
- mc13783_adc_read_temp, NULL, 17);
163
+static SENSOR_DEVICE_ATTR_RO(in2_input, mc13783_adc_bp, 2);
164
+static SENSOR_DEVICE_ATTR_RO(in5_input, mc13783_adc_gp, 5);
165
+static SENSOR_DEVICE_ATTR_RO(in6_input, mc13783_adc_gp, 6);
166
+static SENSOR_DEVICE_ATTR_RO(in7_input, mc13783_adc_gp, 7);
167
+static SENSOR_DEVICE_ATTR_RO(in8_input, mc13783_adc_gp, 8);
168
+static SENSOR_DEVICE_ATTR_RO(in9_input, mc13783_adc_gp, 9);
169
+static SENSOR_DEVICE_ATTR_RO(in10_input, mc13783_adc_gp, 10);
170
+static SENSOR_DEVICE_ATTR_RO(in11_input, mc13783_adc_gp, 11);
171
+static SENSOR_DEVICE_ATTR_RO(in12_input, mc13783_adc_gp, 12);
172
+static SENSOR_DEVICE_ATTR_RO(in13_input, mc13783_adc_gp, 13);
173
+static SENSOR_DEVICE_ATTR_RO(in14_input, mc13783_adc_gp, 14);
174
+static SENSOR_DEVICE_ATTR_RO(in15_input, mc13783_adc_gp, 15);
175
+static SENSOR_DEVICE_ATTR_RO(in16_input, mc13783_adc_uid, 16);
176
+static SENSOR_DEVICE_ATTR_RO(temp1_input, mc13783_adc_temp, 17);
186177
187178 static struct attribute *mc13783_attr_base[] = {
188179 &dev_attr_name.attr,