[PATCH 1061/1285] Replace numeric parameter like 0444 with macro

From: Baole Ni
Date: Tue Aug 02 2016 - 10:17:55 EST


I find that the developers often just specified the numeric value
when calling a macro which is defined with a parameter for access permission.
As we know, these numeric value for access permission have had the corresponding macro,
and that using macro can improve the robustness and readability of the code,
thus, I suggest replacing the numeric parameter with the macro.

Signed-off-by: Chuansheng Liu <chuansheng.liu@xxxxxxxxx>
Signed-off-by: Baole Ni <baolex.ni@xxxxxxxxx>
---
kernel/cpu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index d948e44..dd3162d 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1513,7 +1513,7 @@ static ssize_t show_cpuhp_state(struct device *dev,

return sprintf(buf, "%d\n", st->state);
}
-static DEVICE_ATTR(state, 0444, show_cpuhp_state, NULL);
+static DEVICE_ATTR(state, S_IRUSR | S_IRGRP | S_IROTH, show_cpuhp_state, NULL);

static ssize_t write_cpuhp_target(struct device *dev,
struct device_attribute *attr,
@@ -1562,7 +1562,7 @@ static ssize_t show_cpuhp_target(struct device *dev,

return sprintf(buf, "%d\n", st->target);
}
-static DEVICE_ATTR(target, 0644, show_cpuhp_target, write_cpuhp_target);
+static DEVICE_ATTR(target, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, show_cpuhp_target, write_cpuhp_target);

static struct attribute *cpuhp_cpu_attrs[] = {
&dev_attr_state.attr,
@@ -1595,7 +1595,7 @@ static ssize_t show_cpuhp_states(struct device *dev,
mutex_unlock(&cpuhp_state_mutex);
return res;
}
-static DEVICE_ATTR(states, 0444, show_cpuhp_states, NULL);
+static DEVICE_ATTR(states, S_IRUSR | S_IRGRP | S_IROTH, show_cpuhp_states, NULL);

static struct attribute *cpuhp_cpu_root_attrs[] = {
&dev_attr_states.attr,
--
2.9.2