Replace numeric parameter like 0444 with macro
PATCH 32/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/x86/kernel/cpu/mcheck/mce.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +4 -4
@@ -2345,10 +2345,10 @@ static ssize_t store_int_with_restart(struct device *s,return ret; } -static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger); -static DEVICE_INT_ATTR(tolerant, 0644, mca_cfg.tolerant); -static DEVICE_INT_ATTR(monarch_timeout, 0644, mca_cfg.monarch_timeout); -static DEVICE_BOOL_ATTR(dont_log_ce, 0644, mca_cfg.dont_log_ce); +static DEVICE_ATTR(trigger, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, show_trigger, set_trigger); +static DEVICE_INT_ATTR(tolerant, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, mca_cfg.tolerant); +static DEVICE_INT_ATTR(monarch_timeout, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, mca_cfg.monarch_timeout); +static DEVICE_BOOL_ATTR(dont_log_ce, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, mca_cfg.dont_log_ce);static struct dev_ext_attribute dev_attr_check_interval = {__ATTR (check_interval,0644 , device_show_int, store_int_with_restart),
Signature · 1 line
2.9.2
Borislav Petkov
maintainerFirst of all,
what is that flood of patches and why am I on CC on so many, even if I don't have anything to do with the code most of them touch? Have you heard of get_maintainer.pl?
Then, I'd never do all that "work" that if I were you.
Then, your patch Subject is the *same* on every patch. Not good.
Ditto for the commit message but I guess one can do only so many variations of the same thing.
Quoted 5 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.
I don't think this is a valid argument - I can understand 0644 much faster than the macros but maybe this is just me...
Quoted 2 lines
Signed-off-by Chuansheng Liu <[email protected]>Signed-off-by Baole Ni <[email protected]>
This SOB chain is wrong. Why are there two people doing a trivial patch?
Quoted 10 lines
--- arch/x86/kernel/cpu/mcheck/mce.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)arch/x86/kernel/cpu/mcheck/mce.c +0
-0@@ -2345,10 +2345,10 @@ static ssize_t store_int_with_restart(struct device *s,return ret;
arch/x86/kernel/cpu/mcheck/mce.c static ssize_t store_int_with_restart(struct device *s, · line 2351
Quoted 10 lines
arch/x86/kernel/cpu/mcheck/mce.c +4
-4} -static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger); -static DEVICE_INT_ATTR(tolerant, 0644, mca_cfg.tolerant); -static DEVICE_INT_ATTR(monarch_timeout, 0644, mca_cfg.monarch_timeout); -static DEVICE_BOOL_ATTR(dont_log_ce, 0644, mca_cfg.dont_log_ce); +static DEVICE_ATTR(trigger, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, show_trigger, set_trigger); +static DEVICE_INT_ATTR(tolerant, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, mca_cfg.tolerant); +static DEVICE_INT_ATTR(monarch_timeout, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, mca_cfg.monarch_timeout); +static DEVICE_BOOL_ATTR(dont_log_ce, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, mca_cfg.dont_log_ce);
So no, I won't take this senseless churn - it doesn't fix or improve anything IMO.
Signature · 5 lines
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--