Skip to contentSkip to conversation

Replace numeric parameter like 0444 with macro

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

Subsystems (2)
lore
Share & tools
lore

Baole Ni

author
#0 lore raw

PATCH 486/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/media/pci/ivtv/ivtv-driver.c | 48 ++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/media/pci/ivtv/ivtv-driver.c +24 -24
index 374033a..e3646f8 100644
@@ -141,32 +141,32 @@ int ivtv_fw_debug;
 static int tunertype = -1;
 static int newi2c = -1;
 
-module_param_array(tuner, int, &tuner_c, 0644);
-module_param_array(radio, int, &radio_c, 0644);
-module_param_array(cardtype, int, &cardtype_c, 0644);
-module_param_string(pal, pal, sizeof(pal), 0644);
-module_param_string(secam, secam, sizeof(secam), 0644);
-module_param_string(ntsc, ntsc, sizeof(ntsc), 0644);
-module_param_named(debug,ivtv_debug, int, 0644);
+module_param_array(tuner, int, &tuner_c, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param_array(radio, int, &radio_c, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param_array(cardtype, int, &cardtype_c, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param_string(pal, pal, sizeof(pal), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param_string(secam, secam, sizeof(secam), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param_string(ntsc, ntsc, sizeof(ntsc), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param_named(debug,ivtv_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 #ifdef CONFIG_VIDEO_ADV_DEBUG
-module_param_named(fw_debug, ivtv_fw_debug, int, 0644);
+module_param_named(fw_debug, ivtv_fw_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 #endif
-module_param(ivtv_pci_latency, int, 0644);
-module_param(ivtv_yuv_mode, int, 0644);
-module_param(ivtv_yuv_threshold, int, 0644);
-module_param(ivtv_first_minor, int, 0644);
-
-module_param(enc_mpg_buffers, int, 0644);
-module_param(enc_yuv_buffers, int, 0644);
-module_param(enc_vbi_buffers, int, 0644);
-module_param(enc_pcm_buffers, int, 0644);
-module_param(dec_mpg_buffers, int, 0644);
-module_param(dec_yuv_buffers, int, 0644);
-module_param(dec_vbi_buffers, int, 0644);
-
-module_param(tunertype, int, 0644);
-module_param(newi2c, int, 0644);
-module_param_array(i2c_clock_period, int, &i2c_clock_period_c, 0644);
+module_param(ivtv_pci_latency, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(ivtv_yuv_mode, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(ivtv_yuv_threshold, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(ivtv_first_minor, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+module_param(enc_mpg_buffers, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(enc_yuv_buffers, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(enc_vbi_buffers, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(enc_pcm_buffers, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(dec_mpg_buffers, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(dec_yuv_buffers, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(dec_vbi_buffers, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+module_param(tunertype, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param(newi2c, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+module_param_array(i2c_clock_period, int, &i2c_clock_period_c, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 MODULE_PARM_DESC(tuner, "Tuner type selection,\n"
 			"\t\t\tsee tuner.h for values");
Signature · 1 line
2.9.2