Replace numeric parameter like 0444 with macro
PATCH 1061/1285 Replace numeric parameter like 0444 with macro
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 <[email protected]>
Signed-off-by Baole Ni <[email protected]>
--- kernel/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/cpu.c +3 -3
@@ -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,
Signature · 1 line
2.9.2