Skip to contentSkip to conversation

Replace numeric parameter like 0444 with macro

PATCH NAK Baole Ni 3 participants 3 messages Aug 2, 2016 – Aug 19, 2016

Subsystems (2)
lore
Share & tools
lore

Baole Ni

author
#0 lore raw

PATCH 841/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.

---
 drivers/platform/x86/acerhdf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/acerhdf.c +4 -4
index 460fa67..a4706dd 100644
@@ -96,13 +96,13 @@ static struct platform_device *acerhdf_dev;
 
 module_param(kernelmode, uint, 0);
 MODULE_PARM_DESC(kernelmode, "Kernel mode fan control on / off");
-module_param(interval, uint, 0600);
+module_param(interval, uint, S_IRUSR | S_IWUSR);
 MODULE_PARM_DESC(interval, "Polling interval of temperature check");
-module_param(fanon, uint, 0600);
+module_param(fanon, uint, S_IRUSR | S_IWUSR);
 MODULE_PARM_DESC(fanon, "Turn the fan on above this temperature");
-module_param(fanoff, uint, 0600);
+module_param(fanoff, uint, S_IRUSR | S_IWUSR);
 MODULE_PARM_DESC(fanoff, "Turn the fan off below this temperature");
-module_param(verbose, uint, 0600);
+module_param(verbose, uint, S_IRUSR | S_IWUSR);
 MODULE_PARM_DESC(verbose, "Enable verbose dmesg output");
 module_param_string(force_bios, force_bios, 16, 0);
 MODULE_PARM_DESC(force_bios, "Force BIOS version and omit BIOS check");
Signature · 1 line
2.9.2
maintainer Acked-by on v1 841/1285
#1 lore raw
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.

Quoted 28 lines

---
drivers/platform/x86/acerhdf.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/acerhdf.c +4 -4
index 460fa67..a4706dd 100644
@@ -96,13 +96,13 @@ static struct platform_device *acerhdf_dev;
 
 module_param(kernelmode, uint, 0);
 MODULE_PARM_DESC(kernelmode, "Kernel mode fan control on / off");
-module_param(interval, uint, 0600);
+module_param(interval, uint, S_IRUSR | S_IWUSR);
 MODULE_PARM_DESC(interval, "Polling interval of temperature check");
-module_param(fanon, uint, 0600);
+module_param(fanon, uint, S_IRUSR | S_IWUSR);
 MODULE_PARM_DESC(fanon, "Turn the fan on above this temperature");
-module_param(fanoff, uint, 0600);
+module_param(fanoff, uint, S_IRUSR | S_IWUSR);
 MODULE_PARM_DESC(fanoff, "Turn the fan off below this temperature");
-module_param(verbose, uint, 0600);
+module_param(verbose, uint, S_IRUSR | S_IWUSR);
 MODULE_PARM_DESC(verbose, "Enable verbose dmesg output");
 module_param_string(force_bios, force_bios, 16, 0);
 MODULE_PARM_DESC(force_bios, "Force BIOS version and omit BIOS check");
Signature · 1 line
2.9.2
Signature · 2 lines
thanks,
--peter;
#2 lore raw
Quoted 11 lines · Peter Feuerer
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.

Due to objections elsewhere in the platform drivers subsystem, I have rejected these patches as a group, leaving it to the authors to make the argument for inclusion if they disagree with the decision.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center