Re: [PATCH v2] Accessiblity: speakup: specifying the default driver parameters among the module params
From: Samuel Thibault
Date: Sat Oct 15 2022 - 17:30:43 EST
Osama Muhammad, le ven. 14 oct. 2022 03:30:24 +0500, a ecrit:
> This is an enhancement which allows to specify the default driver
> parameters among the module parameters.
>
> Adding default variables to the speakup_soft module
> allows to easily set that at boot, rather than
> setting the sys variables after boot.
> More details can be found here:
> https://github.com/linux-speakup/speakup/issues/7
>
> Signed-off-by: Osama Muhammad <osmtendev@xxxxxxxxx>
>
> ---
>
> Changes since v1:
> - Added NB_ID as the last member of enum default_vars_id.
> - Added NB_ID as the size of array vars.
> - Made sure that that the enteries in vars are in correct order.
Thanks!
It looks almost good to me now.
> ---
> drivers/accessibility/speakup/speakup_soft.c | 57 ++++++++++++++------
> 1 file changed, 42 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/accessibility/speakup/speakup_soft.c b/drivers/accessibility/speakup/speakup_soft.c
> index 28c8f60370cf..5d8e2c1e7f4c 100644
> --- a/drivers/accessibility/speakup/speakup_soft.c
> +++ b/drivers/accessibility/speakup/speakup_soft.c
> @@ -33,21 +33,30 @@ static struct miscdevice synth_device, synthu_device;
> static int init_pos;
> static int misc_registered;
>
> -static struct var_t vars[] = {
> +
> +enum default_vars_id {
> + DIRECT_ID = 0, CAPS_START_ID, CAPS_STOP_ID,
> + PAUSE_ID, RATE_ID, PITCH_ID, INFLECTION_ID,
> + VOL_ID, TONE_ID, PUNCT_ID, VOICE_ID,
> + FREQUENCY_ID, V_LAST_VAR_ID,
> + NB_ID
> +};
> +
> +
> +static struct var_t vars[NB_ID] = {
> /* DIRECT is put first so that module_param_named can access it easily */
> - { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } },
> -
You can now remove the comment, since now the ordering is not important.
Samuel