Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Accessiblity: speakup_audptr: specifying the default driver parameters among the module params

This is an enhancement which allows to specify the default driver
parameters among the module parameters.

Adding a default variables to the speakup_audptr 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@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Link: https://lore.kernel.org/r/20221109215108.7933-4-osmtendev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Osama Muhammad and committed by
Greg Kroah-Hartman
d5dab7ff 5e3e27f0

+33 -9
+33 -9
drivers/accessibility/speakup/speakup_audptr.c
··· 19 19 static int synth_probe(struct spk_synth *synth); 20 20 static void synth_flush(struct spk_synth *synth); 21 21 22 - static struct var_t vars[] = { 23 - { CAPS_START, .u.s = {"\x05[f99]" } }, 24 - { CAPS_STOP, .u.s = {"\x05[f80]" } }, 25 - { RATE, .u.n = {"\x05[r%d]", 10, 0, 20, 100, -10, NULL } }, 26 - { PITCH, .u.n = {"\x05[f%d]", 80, 39, 4500, 0, 0, NULL } }, 27 - { VOL, .u.n = {"\x05[g%d]", 21, 0, 40, 0, 0, NULL } }, 28 - { TONE, .u.n = {"\x05[s%d]", 9, 0, 63, 0, 0, NULL } }, 29 - { PUNCT, .u.n = {"\x05[A%c]", 0, 0, 3, 0, 0, "nmsa" } }, 30 - { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 22 + 23 + enum default_vars_id { 24 + CAPS_START_ID = 0, CAPS_STOP_ID, 25 + RATE_ID, PITCH_ID, 26 + VOL_ID, TONE_ID, PUNCT_ID, 27 + DIRECT_ID, V_LAST_VAR_ID, 28 + NB_ID 29 + }; 30 + 31 + static struct var_t vars[NB_ID] = { 32 + [CAPS_START_ID] = { CAPS_START, .u.s = {"\x05[f99]" } }, 33 + [CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\x05[f80]" } }, 34 + [RATE_ID] = { RATE, .u.n = {"\x05[r%d]", 10, 0, 20, 100, -10, NULL } }, 35 + [PITCH_ID] = { PITCH, .u.n = {"\x05[f%d]", 80, 39, 4500, 0, 0, NULL } }, 36 + [VOL_ID] = { VOL, .u.n = {"\x05[g%d]", 21, 0, 40, 0, 0, NULL } }, 37 + [TONE_ID] = { TONE, .u.n = {"\x05[s%d]", 9, 0, 63, 0, 0, NULL } }, 38 + [PUNCT_ID] = { PUNCT, .u.n = {"\x05[A%c]", 0, 0, 3, 0, 0, "nmsa" } }, 39 + [DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 31 40 V_LAST_VAR 32 41 }; 33 42 ··· 167 158 module_param_named(ser, synth_audptr.ser, int, 0444); 168 159 module_param_named(dev, synth_audptr.dev_name, charp, 0444); 169 160 module_param_named(start, synth_audptr.startup, short, 0444); 161 + module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444); 162 + module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444); 163 + module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444); 164 + module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444); 165 + module_param_named(punct, vars[PUNCT_ID].u.n.default_val, int, 0444); 166 + module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444); 167 + 168 + 170 169 171 170 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); 172 171 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); 173 172 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); 173 + MODULE_PARM_DESC(rate, "Set the rate variable on load."); 174 + MODULE_PARM_DESC(pitch, "Set the pitch variable on load."); 175 + MODULE_PARM_DESC(vol, "Set the vol variable on load."); 176 + MODULE_PARM_DESC(tone, "Set the tone variable on load."); 177 + MODULE_PARM_DESC(punct, "Set the punct variable on load."); 178 + MODULE_PARM_DESC(direct, "Set the direct variable on load."); 179 + 174 180 175 181 module_spk_synth(synth_audptr); 176 182