[PATCH 0534/1285] Replace numeric parameter like 0444 with macro
From: Baole Ni
Date: Tue Aug 02 2016 - 12:53:57 EST
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.
Signed-off-by: Chuansheng Liu <chuansheng.liu@xxxxxxxxx>
Signed-off-by: Baole Ni <baolex.ni@xxxxxxxxx>
---
drivers/media/platform/vivid/vivid-core.c | 36 +++++++++++++++----------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c
index c14da84..608fa85 100644
--- a/drivers/media/platform/vivid/vivid-core.c
+++ b/drivers/media/platform/vivid/vivid-core.c
@@ -58,56 +58,56 @@ MODULE_AUTHOR("Hans Verkuil");
MODULE_LICENSE("GPL");
static unsigned n_devs = 1;
-module_param(n_devs, uint, 0444);
+module_param(n_devs, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(n_devs, " number of driver instances to create");
static int vid_cap_nr[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(vid_cap_nr, int, NULL, 0444);
+module_param_array(vid_cap_nr, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(vid_cap_nr, " videoX start number, -1 is autodetect");
static int vid_out_nr[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(vid_out_nr, int, NULL, 0444);
+module_param_array(vid_out_nr, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(vid_out_nr, " videoX start number, -1 is autodetect");
static int vbi_cap_nr[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(vbi_cap_nr, int, NULL, 0444);
+module_param_array(vbi_cap_nr, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(vbi_cap_nr, " vbiX start number, -1 is autodetect");
static int vbi_out_nr[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(vbi_out_nr, int, NULL, 0444);
+module_param_array(vbi_out_nr, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(vbi_out_nr, " vbiX start number, -1 is autodetect");
static int sdr_cap_nr[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(sdr_cap_nr, int, NULL, 0444);
+module_param_array(sdr_cap_nr, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(sdr_cap_nr, " swradioX start number, -1 is autodetect");
static int radio_rx_nr[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(radio_rx_nr, int, NULL, 0444);
+module_param_array(radio_rx_nr, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(radio_rx_nr, " radioX start number, -1 is autodetect");
static int radio_tx_nr[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(radio_tx_nr, int, NULL, 0444);
+module_param_array(radio_tx_nr, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(radio_tx_nr, " radioX start number, -1 is autodetect");
static int ccs_cap_mode[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(ccs_cap_mode, int, NULL, 0444);
+module_param_array(ccs_cap_mode, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(ccs_cap_mode, " capture crop/compose/scale mode:\n"
"\t\t bit 0=crop, 1=compose, 2=scale,\n"
"\t\t -1=user-controlled (default)");
static int ccs_out_mode[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = -1 };
-module_param_array(ccs_out_mode, int, NULL, 0444);
+module_param_array(ccs_out_mode, int, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(ccs_out_mode, " output crop/compose/scale mode:\n"
"\t\t bit 0=crop, 1=compose, 2=scale,\n"
"\t\t -1=user-controlled (default)");
static unsigned multiplanar[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 1 };
-module_param_array(multiplanar, uint, NULL, 0444);
+module_param_array(multiplanar, uint, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(multiplanar, " 1 (default) creates a single planar device, 2 creates a multiplanar device.");
/* Default: video + vbi-cap (raw and sliced) + radio rx + radio tx + sdr + vbi-out + vid-out */
static unsigned node_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x1d3d };
-module_param_array(node_types, uint, NULL, 0444);
+module_param_array(node_types, uint, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(node_types, " node types, default is 0x1d3d. Bitmask with the following meaning:\n"
"\t\t bit 0: Video Capture node\n"
"\t\t bit 2-3: VBI Capture node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both\n"
@@ -120,34 +120,34 @@ MODULE_PARM_DESC(node_types, " node types, default is 0x1d3d. Bitmask with the f
/* Default: 4 inputs */
static unsigned num_inputs[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 4 };
-module_param_array(num_inputs, uint, NULL, 0444);
+module_param_array(num_inputs, uint, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(num_inputs, " number of inputs, default is 4");
/* Default: input 0 = WEBCAM, 1 = TV, 2 = SVID, 3 = HDMI */
static unsigned input_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0xe4 };
-module_param_array(input_types, uint, NULL, 0444);
+module_param_array(input_types, uint, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(input_types, " input types, default is 0xe4. Two bits per input,\n"
"\t\t bits 0-1 == input 0, bits 31-30 == input 15.\n"
"\t\t Type 0 == webcam, 1 == TV, 2 == S-Video, 3 == HDMI");
/* Default: 2 outputs */
static unsigned num_outputs[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 2 };
-module_param_array(num_outputs, uint, NULL, 0444);
+module_param_array(num_outputs, uint, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(num_outputs, " number of outputs, default is 2");
/* Default: output 0 = SVID, 1 = HDMI */
static unsigned output_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 2 };
-module_param_array(output_types, uint, NULL, 0444);
+module_param_array(output_types, uint, NULL, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(output_types, " output types, default is 0x02. One bit per output,\n"
"\t\t bit 0 == output 0, bit 15 == output 15.\n"
"\t\t Type 0 == S-Video, 1 == HDMI");
unsigned vivid_debug;
-module_param(vivid_debug, uint, 0644);
+module_param(vivid_debug, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(vivid_debug, " activates debug info");
static bool no_error_inj;
-module_param(no_error_inj, bool, 0444);
+module_param(no_error_inj, bool, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(no_error_inj, " if set disable the error injecting controls");
static struct vivid_dev *vivid_devs[VIVID_MAX_DEVS];
--
2.9.2