Skip to content

Commit c0ee5d7

Browse files
seehearfeelintel-lab-lkp
authored andcommitted
MIPS: Loongson: Cleanup cpu_hwmon.c
Fix the following checkpatch warnings and errors: ERROR: do not initialise statics to 0 torvalds#14: FILE: drivers/platform/mips/cpu_hwmon.c:14: +static int csr_temp_enable = 0; WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#60: FILE: drivers/platform/mips/cpu_hwmon.c:60: +static SENSOR_DEVICE_ATTR(name, S_IRUGO, get_hwmon_name, NULL, 0); WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#84: FILE: drivers/platform/mips/cpu_hwmon.c:84: +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, get_cpu_temp, NULL, 1); WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#85: FILE: drivers/platform/mips/cpu_hwmon.c:85: +static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, cpu_temp_label, NULL, 1); WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#86: FILE: drivers/platform/mips/cpu_hwmon.c:86: +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, get_cpu_temp, NULL, 2); WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#87: FILE: drivers/platform/mips/cpu_hwmon.c:87: +static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, cpu_temp_label, NULL, 2); WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#88: FILE: drivers/platform/mips/cpu_hwmon.c:88: +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, get_cpu_temp, NULL, 3); WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#89: FILE: drivers/platform/mips/cpu_hwmon.c:89: +static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, cpu_temp_label, NULL, 3); WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#90: FILE: drivers/platform/mips/cpu_hwmon.c:90: +static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, get_cpu_temp, NULL, 4); WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. torvalds#91: FILE: drivers/platform/mips/cpu_hwmon.c:91: +static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, cpu_temp_label, NULL, 4); WARNING: Missing a blank line after declarations torvalds#120: FILE: drivers/platform/mips/cpu_hwmon.c:120: + int id = (to_sensor_dev_attr(attr))->index - 1; + return sprintf(buf, "CPU %d Temperature\n", id); WARNING: Missing a blank line after declarations torvalds#128: FILE: drivers/platform/mips/cpu_hwmon.c:128: + int value = loongson3_cpu_temp(id); + return sprintf(buf, "%d\n", value); ERROR: spaces required around that '=' (ctx:VxV) torvalds#135: FILE: drivers/platform/mips/cpu_hwmon.c:135: + for (i=0; i<nr_packages; i++) ^ ERROR: spaces required around that '<' (ctx:VxV) torvalds#135: FILE: drivers/platform/mips/cpu_hwmon.c:135: + for (i=0; i<nr_packages; i++) ^ ERROR: spaces required around that '=' (ctx:VxV) torvalds#145: FILE: drivers/platform/mips/cpu_hwmon.c:145: + for (i=0; i<nr_packages; i++) ^ ERROR: spaces required around that '<' (ctx:VxV) torvalds#145: FILE: drivers/platform/mips/cpu_hwmon.c:145: + for (i=0; i<nr_packages; i++) ^ ERROR: spaces required around that '=' (ctx:VxV) torvalds#156: FILE: drivers/platform/mips/cpu_hwmon.c:156: + for (i=0; i<nr_packages; i++) { ^ ERROR: spaces required around that '<' (ctx:VxV) torvalds#156: FILE: drivers/platform/mips/cpu_hwmon.c:156: + for (i=0; i<nr_packages; i++) { ^ WARNING: line over 80 characters torvalds#175: FILE: drivers/platform/mips/cpu_hwmon.c:175: + csr_temp_enable = csr_readl(LOONGSON_CSR_FEATURES) & LOONGSON_CSRF_TEMP; Signed-off-by: Tiezhu Yang <[email protected]>
1 parent d5eeab8 commit c0ee5d7

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

drivers/platform/mips/cpu_hwmon.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <loongson_hwmon.h>
1212
#include <loongson_regs.h>
1313

14-
static int csr_temp_enable = 0;
14+
static int csr_temp_enable;
1515

1616
/*
1717
* Loongson-3 series cpu has two sensors inside,
@@ -44,7 +44,7 @@ int loongson3_cpu_temp(int cpu)
4444
case PRID_REV_LOONGSON3A_R3_0:
4545
case PRID_REV_LOONGSON3A_R3_1:
4646
default:
47-
reg = (reg & 0xffff)*731/0x4000 - 273;
47+
reg = (reg & 0xffff) * 731 / 0x4000 - 273;
4848
break;
4949
}
5050

@@ -57,7 +57,7 @@ static struct device *cpu_hwmon_dev;
5757

5858
static ssize_t get_hwmon_name(struct device *dev,
5959
struct device_attribute *attr, char *buf);
60-
static SENSOR_DEVICE_ATTR(name, S_IRUGO, get_hwmon_name, NULL, 0);
60+
static SENSOR_DEVICE_ATTR(name, 0444, get_hwmon_name, NULL, 0);
6161

6262
static struct attribute *cpu_hwmon_attributes[] = {
6363
&sensor_dev_attr_name.dev_attr.attr,
@@ -81,14 +81,14 @@ static ssize_t get_cpu_temp(struct device *dev,
8181
static ssize_t cpu_temp_label(struct device *dev,
8282
struct device_attribute *attr, char *buf);
8383

84-
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, get_cpu_temp, NULL, 1);
85-
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, cpu_temp_label, NULL, 1);
86-
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, get_cpu_temp, NULL, 2);
87-
static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, cpu_temp_label, NULL, 2);
88-
static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, get_cpu_temp, NULL, 3);
89-
static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, cpu_temp_label, NULL, 3);
90-
static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, get_cpu_temp, NULL, 4);
91-
static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, cpu_temp_label, NULL, 4);
84+
static SENSOR_DEVICE_ATTR(temp1_input, 0444, get_cpu_temp, NULL, 1);
85+
static SENSOR_DEVICE_ATTR(temp1_label, 0444, cpu_temp_label, NULL, 1);
86+
static SENSOR_DEVICE_ATTR(temp2_input, 0444, get_cpu_temp, NULL, 2);
87+
static SENSOR_DEVICE_ATTR(temp2_label, 0444, cpu_temp_label, NULL, 2);
88+
static SENSOR_DEVICE_ATTR(temp3_input, 0444, get_cpu_temp, NULL, 3);
89+
static SENSOR_DEVICE_ATTR(temp3_label, 0444, cpu_temp_label, NULL, 3);
90+
static SENSOR_DEVICE_ATTR(temp4_input, 0444, get_cpu_temp, NULL, 4);
91+
static SENSOR_DEVICE_ATTR(temp4_label, 0444, cpu_temp_label, NULL, 4);
9292

9393
static const struct attribute *hwmon_cputemp[4][3] = {
9494
{
@@ -117,6 +117,7 @@ static ssize_t cpu_temp_label(struct device *dev,
117117
struct device_attribute *attr, char *buf)
118118
{
119119
int id = (to_sensor_dev_attr(attr))->index - 1;
120+
120121
return sprintf(buf, "CPU %d Temperature\n", id);
121122
}
122123

@@ -125,14 +126,15 @@ static ssize_t get_cpu_temp(struct device *dev,
125126
{
126127
int id = (to_sensor_dev_attr(attr))->index - 1;
127128
int value = loongson3_cpu_temp(id);
129+
128130
return sprintf(buf, "%d\n", value);
129131
}
130132

131133
static int create_sysfs_cputemp_files(struct kobject *kobj)
132134
{
133135
int i, ret = 0;
134136

135-
for (i=0; i<nr_packages; i++)
137+
for (i = 0; i < nr_packages; i++)
136138
ret = sysfs_create_files(kobj, hwmon_cputemp[i]);
137139

138140
return ret;
@@ -142,7 +144,7 @@ static void remove_sysfs_cputemp_files(struct kobject *kobj)
142144
{
143145
int i;
144146

145-
for (i=0; i<nr_packages; i++)
147+
for (i = 0; i < nr_packages; i++)
146148
sysfs_remove_files(kobj, hwmon_cputemp[i]);
147149
}
148150

@@ -153,7 +155,7 @@ static void do_thermal_timer(struct work_struct *work)
153155
{
154156
int i, value, temp_max = 0;
155157

156-
for (i=0; i<nr_packages; i++) {
158+
for (i = 0; i < nr_packages; i++) {
157159
value = loongson3_cpu_temp(i);
158160
if (value > temp_max)
159161
temp_max = value;
@@ -172,7 +174,8 @@ static int __init loongson_hwmon_init(void)
172174
pr_info("Loongson Hwmon Enter...\n");
173175

174176
if (cpu_has_csr())
175-
csr_temp_enable = csr_readl(LOONGSON_CSR_FEATURES) & LOONGSON_CSRF_TEMP;
177+
csr_temp_enable = csr_readl(LOONGSON_CSR_FEATURES) &
178+
LOONGSON_CSRF_TEMP;
176179

177180
cpu_hwmon_dev = hwmon_device_register(NULL);
178181
if (IS_ERR(cpu_hwmon_dev)) {

0 commit comments

Comments
 (0)