Skip to contentSkip to conversation

Replace numeric parameter like 0444 with macro

PATCH NAK Baole Ni 2 participants 2 messages Aug 2, 2016 – Aug 8, 2016 TPM device driver

lore
Share & tools
lore

Baole Ni

author
#0 lore raw

PATCH 111/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/char/tpm/tpm-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm-interface.c +1 -1
index e2fa89c..d41261d 100644
@@ -44,7 +44,7 @@
  * with an extend to the selected _unused_ non-volatile pcr.
  */
 static int tpm_suspend_pcr;
-module_param_named(suspend_pcr, tpm_suspend_pcr, uint, 0644);
+module_param_named(suspend_pcr, tpm_suspend_pcr, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(suspend_pcr,
 		 "PCR to use for dummy writes to faciltate flush on suspend.");
 
Signature · 1 line
2.9.2
#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.

I choose to ignore this and other similar patches you have submitted for the TPM driver subsystem.

/Jarkko