Skip to contentSkip to conversation

Replace numeric parameter like 0444 with macro

PATCH NAK Baole Ni 4 participants 4 messages Aug 2, 2016 – Aug 10, 2016 I2C subsystem host drivers

lore
Share & tools
lore

Baole Ni

author
#0 lore raw

PATCH 244/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/i2c/busses/i2c-stu300.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-stu300.c +1 -1
index 460c134..8128e25 100644
@@ -133,7 +133,7 @@ enum stu300_error {
 
 /* I2C clock speed, in Hz 0-400kHz*/
 static unsigned int scl_frequency = 100000;
-module_param(scl_frequency, uint,  0644);
+module_param(scl_frequency, uint,  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 /**
  * struct stu300_dev - the stu300 driver state holder
Signature · 1 line
2.9.2
Acked-by on v1 244/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.

I assume Wolfram will merge this.

Yours,
Linus Walleij

#2 lore raw
Quoted 8 lines · CEST Linus Walleij
Quoted 6 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 6 lines
Quoted 2 lines

I assume Wolfram will merge this.

I assume not, see http://lwn.net/Articles/696227/

Arnd

#3 lore raw
Quoted 4 lines
Quoted 2 lines

I assume Wolfram will merge this.

I assume not, see http://lwn.net/Articles/696227/

Thanks for the pointer. I missed the discussion but came up with the same conclusions: a) octals are easier to read and b) original author should have asked if this change was feasible before posting 1285 patches :(

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160810/3b814757/attachment.sig>