aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/k10temp.c
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2016-12-22 07:05:19 -0500
committerGuenter Roeck <linux@roeck-us.net>2017-01-02 13:19:45 -0500
commit0c36d72e57dfdc7bb7a3c39411a675d85f8e672c (patch)
tree5316b6aa7873a0e8d4fc55538924a8dbd1cd6c77 /drivers/hwmon/k10temp.c
parentd5034db6cc1935b1fc8836f887bec034c5e0550e (diff)
hwmon: (k10temp) use permission-specific DEVICE_ATTR variants
Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The conversion was done automatically using coccinelle. It was validated by compiling both the old and the new source code and comparing its text, data, and bss size. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> [groeck: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/k10temp.c')
-rw-r--r--drivers/hwmon/k10temp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
index 9cdfde6515ad..ce3b91f22e30 100644
--- a/drivers/hwmon/k10temp.c
+++ b/drivers/hwmon/k10temp.c
@@ -72,8 +72,8 @@ static void amd_nb_smu_index_read(struct pci_dev *pdev, unsigned int devfn,
72 mutex_unlock(&nb_smu_ind_mutex); 72 mutex_unlock(&nb_smu_ind_mutex);
73} 73}
74 74
75static ssize_t show_temp(struct device *dev, 75static ssize_t temp1_input_show(struct device *dev,
76 struct device_attribute *attr, char *buf) 76 struct device_attribute *attr, char *buf)
77{ 77{
78 u32 regval; 78 u32 regval;
79 struct pci_dev *pdev = dev_get_drvdata(dev); 79 struct pci_dev *pdev = dev_get_drvdata(dev);
@@ -88,8 +88,8 @@ static ssize_t show_temp(struct device *dev,
88 return sprintf(buf, "%u\n", (regval >> 21) * 125); 88 return sprintf(buf, "%u\n", (regval >> 21) * 125);
89} 89}
90 90
91static ssize_t show_temp_max(struct device *dev, 91static ssize_t temp1_max_show(struct device *dev,
92 struct device_attribute *attr, char *buf) 92 struct device_attribute *attr, char *buf)
93{ 93{
94 return sprintf(buf, "%d\n", 70 * 1000); 94 return sprintf(buf, "%d\n", 70 * 1000);
95} 95}
@@ -110,8 +110,8 @@ static ssize_t show_temp_crit(struct device *dev,
110 return sprintf(buf, "%d\n", value); 110 return sprintf(buf, "%d\n", value);
111} 111}
112 112
113static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); 113static DEVICE_ATTR_RO(temp1_input);
114static DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL); 114static DEVICE_ATTR_RO(temp1_max);
115static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); 115static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0);
116static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit, NULL, 1); 116static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit, NULL, 1);
117 117