Skip to contentSkip to conversation

Replace numeric parameter like 0444 with macro

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

lore
Share & tools
lore

Baole Ni

author
#0 lore raw

PATCH 252/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/infiniband/core/mad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/core/mad.c +2 -2
index 2d49228..d78e96f 100644
@@ -52,9 +52,9 @@
 static int mad_sendq_size = IB_MAD_QP_SEND_SIZE;
 static int mad_recvq_size = IB_MAD_QP_RECV_SIZE;
 
-module_param_named(send_queue_size, mad_sendq_size, int, 0444);
+module_param_named(send_queue_size, mad_sendq_size, int, S_IRUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(send_queue_size, "Size of send queue in number of work requests");
-module_param_named(recv_queue_size, mad_recvq_size, int, 0444);
+module_param_named(recv_queue_size, mad_recvq_size, int, S_IRUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(recv_queue_size, "Size of receive queue in number of work requests");
 
 static struct list_head ib_mad_port_list;
Signature · 1 line
2.9.2
Reviewed-by on v1 252/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 23 lines
---
 drivers/infiniband/core/mad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/core/mad.c +2 -2
index 2d49228..d78e96f 100644
@@ -52,9 +52,9 @@
 static int mad_sendq_size = IB_MAD_QP_SEND_SIZE;
 static int mad_recvq_size = IB_MAD_QP_RECV_SIZE;
 
-module_param_named(send_queue_size, mad_sendq_size, int, 0444);
+module_param_named(send_queue_size, mad_sendq_size, int, S_IRUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(send_queue_size, "Size of send queue in number of work requests");
-module_param_named(recv_queue_size, mad_recvq_size, int, 0444);
+module_param_named(recv_queue_size, mad_recvq_size, int, S_IRUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(recv_queue_size, "Size of receive queue in number of work requests");
 
 static struct list_head ib_mad_port_list;
Signature · 1 line
2.9.2