hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hwmon/via-cputemp.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * via-cputemp.c - Driver for VIA CPU core temperature monitoring
34 * Copyright (C) 2009 VIA Technologies, Inc.
....@@ -5,20 +6,6 @@
56 * based on existing coretemp.c, which is
67 *
78 * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; version 2 of the License.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
- * 02110-1301 USA.
229 */
2310
2411 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -60,8 +47,8 @@
6047 * Sysfs stuff
6148 */
6249
63
-static ssize_t show_name(struct device *dev, struct device_attribute
64
- *devattr, char *buf)
50
+static ssize_t name_show(struct device *dev, struct device_attribute *devattr,
51
+ char *buf)
6552 {
6653 int ret;
6754 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
....@@ -74,8 +61,8 @@
7461 return ret;
7562 }
7663
77
-static ssize_t show_temp(struct device *dev,
78
- struct device_attribute *devattr, char *buf)
64
+static ssize_t temp_show(struct device *dev, struct device_attribute *devattr,
65
+ char *buf)
7966 {
8067 struct via_cputemp_data *data = dev_get_drvdata(dev);
8168 u32 eax, edx;
....@@ -102,10 +89,9 @@
10289 return sprintf(buf, "%d\n", vid_from_reg(~edx & 0x7f, data->vrm));
10390 }
10491
105
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL,
106
- SHOW_TEMP);
107
-static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL);
108
-static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME);
92
+static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, SHOW_TEMP);
93
+static SENSOR_DEVICE_ATTR_RO(temp1_label, name, SHOW_LABEL);
94
+static SENSOR_DEVICE_ATTR_RO(name, name, SHOW_NAME);
10995
11096 static struct attribute *via_cputemp_attributes[] = {
11197 &sensor_dev_attr_name.dev_attr.attr,
....@@ -284,10 +270,10 @@
284270 }
285271
286272 static const struct x86_cpu_id __initconst cputemp_ids[] = {
287
- { X86_VENDOR_CENTAUR, 6, 0xa, }, /* C7 A */
288
- { X86_VENDOR_CENTAUR, 6, 0xd, }, /* C7 D */
289
- { X86_VENDOR_CENTAUR, 6, 0xf, }, /* Nano */
290
- { X86_VENDOR_CENTAUR, 7, X86_MODEL_ANY, },
273
+ X86_MATCH_VENDOR_FAM_MODEL(CENTAUR, 6, X86_CENTAUR_FAM6_C7_A, NULL),
274
+ X86_MATCH_VENDOR_FAM_MODEL(CENTAUR, 6, X86_CENTAUR_FAM6_C7_D, NULL),
275
+ X86_MATCH_VENDOR_FAM_MODEL(CENTAUR, 6, X86_CENTAUR_FAM6_NANO, NULL),
276
+ X86_MATCH_VENDOR_FAM_MODEL(CENTAUR, 7, X86_MODEL_ANY, NULL),
291277 {}
292278 };
293279 MODULE_DEVICE_TABLE(x86cpu, cputemp_ids);