Skip to contentSkip to conversation

Replace numeric parameter like 0444 with macro

PATCH NAK Baole Ni 1 participant 1 message Aug 2, 2016 USB

lore
Share & tools
lore

Baole Ni

author
#0 lore raw

PATCH 979/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/usb/gadget/udc/net2272.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/net2272.c +5 -5
index 18f5ebd..74b38f3 100644
@@ -68,7 +68,7 @@ static const char * const ep_name[] = {
  * If use_dma is disabled, pio will be used instead.
  */
 static bool use_dma = 0;
-module_param(use_dma, bool, 0644);
+module_param(use_dma, bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 /*
  * dma_ep: selects the endpoint for use with dma (1=ep-a, 2=ep-b)
@@ -82,7 +82,7 @@ module_param(use_dma, bool, 0644);
  * terminate prematurely (See NET2272 Errata 630-0213-0101)
  */
 static ushort dma_ep = 1;
-module_param(dma_ep, ushort, 0644);
+module_param(dma_ep, ushort, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 /*
  * dma_mode: net2272 dma mode setting (see LOCCTL1 definiton):
@@ -91,7 +91,7 @@ module_param(dma_ep, ushort, 0644);
  *	mode 2 == Burst mode
  */
 static ushort dma_mode = 2;
-module_param(dma_mode, ushort, 0644);
+module_param(dma_mode, ushort, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 #else
 #define use_dma 0
 #define dma_ep 1
@@ -106,7 +106,7 @@ module_param(dma_mode, ushort, 0644);
  *      mode 3 == ep-a 1k, ep-b disabled, ep-c 512db
  */
 static ushort fifo_mode = 0;
-module_param(fifo_mode, ushort, 0644);
+module_param(fifo_mode, ushort, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 /*
  * enable_suspend: When enabled, the driver will respond to
@@ -115,7 +115,7 @@ module_param(fifo_mode, ushort, 0644);
  * self-powered devices.  For bus powered devices set this to 1.
  */
 static ushort enable_suspend = 0;
-module_param(enable_suspend, ushort, 0644);
+module_param(enable_suspend, ushort, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 static void assert_out_naking(struct net2272_ep *ep, const char *where)
 {
Signature · 1 line
2.9.2