Replace numeric parameter like 0444 with macro
PATCH 11/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.
--- arch/avr32/kernel/cpu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/avr32/kernel/cpu.c +6 -6
@@ -171,12 +171,12 @@ static ssize_t store_pcenable(struct device *dev,return count; } -static DEVICE_ATTR(pc0event, 0600, show_pc0event, store_pc0event); -static DEVICE_ATTR(pc0count, 0600, show_pc0count, store_pc0count); -static DEVICE_ATTR(pc1event, 0600, show_pc1event, store_pc1event); -static DEVICE_ATTR(pc1count, 0600, show_pc1count, store_pc1count); -static DEVICE_ATTR(pccycles, 0600, show_pccycles, store_pccycles); -static DEVICE_ATTR(pcenable, 0600, show_pcenable, store_pcenable); +static DEVICE_ATTR(pc0event, S_IRUSR | S_IWUSR, show_pc0event, store_pc0event); +static DEVICE_ATTR(pc0count, S_IRUSR | S_IWUSR, show_pc0count, store_pc0count); +static DEVICE_ATTR(pc1event, S_IRUSR | S_IWUSR, show_pc1event, store_pc1event); +static DEVICE_ATTR(pc1count, S_IRUSR | S_IWUSR, show_pc1count, store_pc1count); +static DEVICE_ATTR(pccycles, S_IRUSR | S_IWUSR, show_pccycles, store_pccycles); +static DEVICE_ATTR(pcenable, S_IRUSR | S_IWUSR, show_pcenable, store_pcenable);#endif /* CONFIG_PERFORMANCE_COUNTERS */
Signature · 1 line
2.9.2
Quoted 8 lines · Baole 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 <[email protected]>Signed-off-by Baole Ni <[email protected]>
Fine by me.
Quoted 26 lines
--- arch/avr32/kernel/cpu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)arch/avr32/kernel/cpu.c +6
-6@@ -171,12 +171,12 @@ static ssize_t store_pcenable(struct device *dev,return count; } -static DEVICE_ATTR(pc0event, 0600, show_pc0event, store_pc0event); -static DEVICE_ATTR(pc0count, 0600, show_pc0count, store_pc0count); -static DEVICE_ATTR(pc1event, 0600, show_pc1event, store_pc1event); -static DEVICE_ATTR(pc1count, 0600, show_pc1count, store_pc1count); -static DEVICE_ATTR(pccycles, 0600, show_pccycles, store_pccycles); -static DEVICE_ATTR(pcenable, 0600, show_pcenable, store_pcenable); +static DEVICE_ATTR(pc0event, S_IRUSR | S_IWUSR, show_pc0event, store_pc0event); +static DEVICE_ATTR(pc0count, S_IRUSR | S_IWUSR, show_pc0count, store_pc0count); +static DEVICE_ATTR(pc1event, S_IRUSR | S_IWUSR, show_pc1event, store_pc1event); +static DEVICE_ATTR(pc1count, S_IRUSR | S_IWUSR, show_pc1count, store_pc1count); +static DEVICE_ATTR(pccycles, S_IRUSR | S_IWUSR, show_pccycles, store_pccycles); +static DEVICE_ATTR(pcenable, S_IRUSR | S_IWUSR, show_pcenable, store_pcenable);#endif /* CONFIG_PERFORMANCE_COUNTERS */
Signature · 2 lines
Best regards, Hans-Christian Noren Egtvedt