Re: [PATCH v3 1/4] media: visl,vidtv: Set parameters permissions to 0444

Hans Verkuil
2023-12-06T09:45:44Z

On 23/11/2023 20:57, Detlev Casanova wrote:
> This avoids confusion with default values and lets userspace
> programs get the modules parameters values at run time.
>
> This can be useful when setting up a test suite.

You missed a few more:

$ git grep "module_param.*, 0)" drivers/media/test-drivers/
drivers/media/test-drivers/vidtv/vidtv_bridge.c:module_param_array(vidtv_valid_dvb_t_freqs, uint, NULL, 0);
drivers/media/test-drivers/vidtv/vidtv_bridge.c:module_param_array(vidtv_valid_dvb_c_freqs, uint, NULL, 0);
drivers/media/test-drivers/vidtv/vidtv_bridge.c:module_param_array(vidtv_valid_dvb_s_freqs, uint, NULL, 0);

Regards,

Hans

>
> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> ---
> .../media/test-drivers/vidtv/vidtv_bridge.c | 20 +++++++++----------
> drivers/media/test-drivers/visl/visl-core.c | 10 +++++-----
> 2 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
> index 8b04e12af286..5dd7b1b4f7f1 100644
> --- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
> +++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
> @@ -45,21 +45,21 @@
> #define LNB_HIGH_FREQ 10600000 /* transition frequency */
>
> static unsigned int drop_tslock_prob_on_low_snr;
> -module_param(drop_tslock_prob_on_low_snr, uint, 0);
> +module_param(drop_tslock_prob_on_low_snr, uint, 0444);
> MODULE_PARM_DESC(drop_tslock_prob_on_low_snr,
> "Probability of losing the TS lock if the signal quality is bad");
>
> static unsigned int recover_tslock_prob_on_good_snr;
> -module_param(recover_tslock_prob_on_good_snr, uint, 0);
> +module_param(recover_tslock_prob_on_good_snr, uint, 0444);
> MODULE_PARM_DESC(recover_tslock_prob_on_good_snr,
> "Probability recovering the TS lock when the signal improves");
>
> static unsigned int mock_power_up_delay_msec;
> -module_param(mock_power_up_delay_msec, uint, 0);
> +module_param(mock_power_up_delay_msec, uint, 0444);
> MODULE_PARM_DESC(mock_power_up_delay_msec, "Simulate a power up delay");
>
> static unsigned int mock_tune_delay_msec;
> -module_param(mock_tune_delay_msec, uint, 0);
> +module_param(mock_tune_delay_msec, uint, 0444);
> MODULE_PARM_DESC(mock_tune_delay_msec, "Simulate a tune delay");
>
> static unsigned int vidtv_valid_dvb_t_freqs[NUM_VALID_TUNER_FREQS] = {
> @@ -86,7 +86,7 @@ MODULE_PARM_DESC(vidtv_valid_dvb_s_freqs,
> "Valid DVB-S/S2 frequencies to simulate at Ku-Band, in kHz");
>
> static unsigned int max_frequency_shift_hz;
> -module_param(max_frequency_shift_hz, uint, 0);
> +module_param(max_frequency_shift_hz, uint, 0444);
> MODULE_PARM_DESC(max_frequency_shift_hz,
> "Maximum shift in HZ allowed when tuning in a channel");
>
> @@ -96,24 +96,24 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nums);
> * Influences the signal acquisition time. See ISO/IEC 13818-1 : 2000. p. 113.
> */
> static unsigned int si_period_msec = 40;
> -module_param(si_period_msec, uint, 0);
> +module_param(si_period_msec, uint, 0444);
> MODULE_PARM_DESC(si_period_msec, "How often to send SI packets. Default: 40ms");
>
> static unsigned int pcr_period_msec = 40;
> -module_param(pcr_period_msec, uint, 0);
> +module_param(pcr_period_msec, uint, 0444);
> MODULE_PARM_DESC(pcr_period_msec,
> "How often to send PCR packets. Default: 40ms");
>
> static unsigned int mux_rate_kbytes_sec = 4096;
> -module_param(mux_rate_kbytes_sec, uint, 0);
> +module_param(mux_rate_kbytes_sec, uint, 0444);
> MODULE_PARM_DESC(mux_rate_kbytes_sec, "Mux rate: will pad stream if below");
>
> static unsigned int pcr_pid = 0x200;
> -module_param(pcr_pid, uint, 0);
> +module_param(pcr_pid, uint, 0444);
> MODULE_PARM_DESC(pcr_pid, "PCR PID for all channels: defaults to 0x200");
>
> static unsigned int mux_buf_sz_pkts;
> -module_param(mux_buf_sz_pkts, uint, 0);
> +module_param(mux_buf_sz_pkts, uint, 0444);
> MODULE_PARM_DESC(mux_buf_sz_pkts,
> "Size for the internal mux buffer in multiples of 188 bytes");
>
> diff --git a/drivers/media/test-drivers/visl/visl-core.c b/drivers/media/test-drivers/visl/visl-core.c
> index 9970dc739ca5..ef89eead6671 100644
> --- a/drivers/media/test-drivers/visl/visl-core.c
> +++ b/drivers/media/test-drivers/visl/visl-core.c
> @@ -64,27 +64,27 @@ MODULE_PARM_DESC(visl_transtime_ms, " simulated process time in milliseconds.");
> * particular number of frames
> */
> int visl_dprintk_frame_start = -1;
> -module_param(visl_dprintk_frame_start, int, 0);
> +module_param(visl_dprintk_frame_start, int, 0444);
> MODULE_PARM_DESC(visl_dprintk_frame_start,
> " a frame number to start tracing with dprintk");
>
> unsigned int visl_dprintk_nframes;
> -module_param(visl_dprintk_nframes, uint, 0);
> +module_param(visl_dprintk_nframes, uint, 0444);
> MODULE_PARM_DESC(visl_dprintk_nframes,
> " the number of frames to trace with dprintk");
>
> bool keep_bitstream_buffers;
> -module_param(keep_bitstream_buffers, bool, false);
> +module_param(keep_bitstream_buffers, bool, 0444);
> MODULE_PARM_DESC(keep_bitstream_buffers,
> " keep bitstream buffers in debugfs after streaming is stopped");
>
> int bitstream_trace_frame_start = -1;
> -module_param(bitstream_trace_frame_start, int, 0);
> +module_param(bitstream_trace_frame_start, int, 0444);
> MODULE_PARM_DESC(bitstream_trace_frame_start,
> " a frame number to start dumping the bitstream through debugfs");
>
> unsigned int bitstream_trace_nframes;
> -module_param(bitstream_trace_nframes, uint, 0);
> +module_param(bitstream_trace_nframes, uint, 0444);
> MODULE_PARM_DESC(bitstream_trace_nframes,
> " the number of frames to dump the bitstream through debugfs");
>