.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * i5500_temp - Driver for Intel 5500/5520/X58 chipset thermal sensor |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2012, 2014 Jean Delvare <jdelvare@suse.de> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
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 | 6 | */ |
---|
16 | 7 | |
---|
17 | 8 | #include <linux/module.h> |
---|
.. | .. |
---|
58 | 49 | return sprintf(buf, "%ld\n", temp); |
---|
59 | 50 | } |
---|
60 | 51 | |
---|
61 | | -static ssize_t show_thresh(struct device *dev, |
---|
| 52 | +static ssize_t thresh_show(struct device *dev, |
---|
62 | 53 | struct device_attribute *devattr, char *buf) |
---|
63 | 54 | { |
---|
64 | 55 | struct pci_dev *pdev = to_pci_dev(dev->parent); |
---|
.. | .. |
---|
72 | 63 | return sprintf(buf, "%ld\n", temp); |
---|
73 | 64 | } |
---|
74 | 65 | |
---|
75 | | -static ssize_t show_alarm(struct device *dev, |
---|
| 66 | +static ssize_t alarm_show(struct device *dev, |
---|
76 | 67 | struct device_attribute *devattr, char *buf) |
---|
77 | 68 | { |
---|
78 | 69 | struct pci_dev *pdev = to_pci_dev(dev->parent); |
---|
.. | .. |
---|
84 | 75 | } |
---|
85 | 76 | |
---|
86 | 77 | static DEVICE_ATTR_RO(temp1_input); |
---|
87 | | -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_thresh, NULL, 0xE2); |
---|
88 | | -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_thresh, NULL, 0xEC); |
---|
89 | | -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_thresh, NULL, 0xEE); |
---|
90 | | -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 0); |
---|
91 | | -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1); |
---|
| 78 | +static SENSOR_DEVICE_ATTR_RO(temp1_crit, thresh, 0xE2); |
---|
| 79 | +static SENSOR_DEVICE_ATTR_RO(temp1_max_hyst, thresh, 0xEC); |
---|
| 80 | +static SENSOR_DEVICE_ATTR_RO(temp1_max, thresh, 0xEE); |
---|
| 81 | +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 0); |
---|
| 82 | +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 1); |
---|
92 | 83 | |
---|
93 | 84 | static struct attribute *i5500_temp_attrs[] = { |
---|
94 | 85 | &dev_attr_temp1_input.attr, |
---|
.. | .. |
---|
117 | 108 | u32 tstimer; |
---|
118 | 109 | s8 tsfsc; |
---|
119 | 110 | |
---|
120 | | - err = pci_enable_device(pdev); |
---|
| 111 | + err = pcim_enable_device(pdev); |
---|
121 | 112 | if (err) { |
---|
122 | 113 | dev_err(&pdev->dev, "Failed to enable device\n"); |
---|
123 | 114 | return err; |
---|