.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * via-cputemp.c - Driver for VIA CPU core temperature monitoring |
---|
3 | 4 | * Copyright (C) 2009 VIA Technologies, Inc. |
---|
.. | .. |
---|
5 | 6 | * based on existing coretemp.c, which is |
---|
6 | 7 | * |
---|
7 | 8 | * 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. |
---|
22 | 9 | */ |
---|
23 | 10 | |
---|
24 | 11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
.. | .. |
---|
60 | 47 | * Sysfs stuff |
---|
61 | 48 | */ |
---|
62 | 49 | |
---|
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) |
---|
65 | 52 | { |
---|
66 | 53 | int ret; |
---|
67 | 54 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
---|
.. | .. |
---|
74 | 61 | return ret; |
---|
75 | 62 | } |
---|
76 | 63 | |
---|
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) |
---|
79 | 66 | { |
---|
80 | 67 | struct via_cputemp_data *data = dev_get_drvdata(dev); |
---|
81 | 68 | u32 eax, edx; |
---|
.. | .. |
---|
102 | 89 | return sprintf(buf, "%d\n", vid_from_reg(~edx & 0x7f, data->vrm)); |
---|
103 | 90 | } |
---|
104 | 91 | |
---|
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); |
---|
109 | 95 | |
---|
110 | 96 | static struct attribute *via_cputemp_attributes[] = { |
---|
111 | 97 | &sensor_dev_attr_name.dev_attr.attr, |
---|
.. | .. |
---|
284 | 270 | } |
---|
285 | 271 | |
---|
286 | 272 | 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), |
---|
291 | 277 | {} |
---|
292 | 278 | }; |
---|
293 | 279 | MODULE_DEVICE_TABLE(x86cpu, cputemp_ids); |
---|