* [PATCH 1061/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 12:12 Baole Ni
0 siblings, 0 replies; only message in thread
From: Baole Ni @ 2016-08-02 12:12 UTC (permalink / raw)
To: anton, ccross, keescook, tony.luck, tomi.valkeinen, m.chehab,
gregkh, m.szyprowski, kyungmin.park, k.kozlowski
Cc: linux-kernel, tglx, peterz, mingo, oleg, akpm, linux,
chuansheng.liu, baolex.ni
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@intel.com>
Signed-off-by: Baole Ni <baolex.ni@intel.com>
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-08-02 14:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02 12:12 [PATCH 1061/1285] Replace numeric parameter like 0444 with macro Baole Ni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®