Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4305139rwi; Sat, 22 Oct 2022 08:04:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dfmFHZ+p4nkCfwGr4r5B7YavmoBAPHLkcPhbTzyYQzmo86JlO3MEC9onKoY7wH2mKySot X-Received: by 2002:aa7:c78e:0:b0:456:c524:90ec with SMTP id n14-20020aa7c78e000000b00456c52490ecmr22512912eds.192.1666451089116; Sat, 22 Oct 2022 08:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666451089; cv=none; d=google.com; s=arc-20160816; b=udxf451ns54aX5nps0lXz++YDv+AieB47q1CHH35wP4gr+dtHE6yEVMLAKMni7lOZW DPHJeX5OlXX/86m/VUP8THpqRrPc6B16SN+hx0A3KUb7Hh4MkSO8peTVjHVH/WoLWe8H 56uz+FBc5yvvdMDOAHFTz3AW8fnh6WfaKP0VzhcW5tGaC6rSpDE0ngKm0Da4qKTkDFjR BCYna+3w+O4EEG8M/oKGuH0qqTzbyLsEliBpqZ6NzJ621yH6q5zb7SuE2SyW7nuNbFAc F2iYKFqSal3P+pXX5Vcm7GJhJK+k70PGOqyu54lfOlDipDNtVrtXTFhShyjKCn+kOafv LhFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/tXvrHCsrelCqwHQuBkqjhcR6QAT/KqaZfHhYAbPR28=; b=v/Igmk16fqHwcMy2lfn92dCnRrW3XP5JVGYW7CExH+V5G4E00bgyckcAAvaTWMlLbf ru1mYiopAW2NZdnVLRaE+s9ZcjFYwuxXkrXO1cUv4ROzC3S/uwxRfhPdU8emRCQi1W6u ytJUhtoeNCziq3XFuJgjAtcBwz0wJDfkLx5XLhtfDnSvMPURt3zsBN5BbTI38uRGxpBF D1VIVhj13oGIEk9JpstDrxL4+6a6J7g68GGSYsTFsZyFJ5c49bj6XO5U7VyB0fmgUr0z HGobs0x08Wsvhg35ErPyWfJz2M0+2csPz/74GqoGfToVIl3Ek5OPx2K2qlqbh8HcXzpk zzzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=faAyIpeB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du14-20020a17090772ce00b00797e151e584si7995248ejc.605.2022.10.22.08.04.14; Sat, 22 Oct 2022 08:04:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=faAyIpeB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbiJVO4w (ORCPT + 99 others); Sat, 22 Oct 2022 10:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiJVO4u (ORCPT ); Sat, 22 Oct 2022 10:56:50 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2DC818E1B for ; Sat, 22 Oct 2022 07:56:48 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id o4so840638wrq.6 for ; Sat, 22 Oct 2022 07:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/tXvrHCsrelCqwHQuBkqjhcR6QAT/KqaZfHhYAbPR28=; b=faAyIpeB74juxp0oI0CEdLXKe789kz5oYbZyPN3v+rV0UzHJlNcAqgGN/8CMehGZZP J6jyDmLHjYuo5wpu+OckOop70PaC6RPM8c7438G2ugEC/Pb9c5SmVf5fdLoMVSKn4mCk y3kPscaIRSPLHXExm6YZU5UBGeWcs/uJcg/mxYHcHteJWB15pl2TaUVZwYIAlv2MyP7l muMB+Y/05JoS74PvnXz3sGAVOH4HexKsHpuGfeeNfF2FOTMKh2mBFb1JG+nmkCwtlLyV kcywv4qB/3H/Zm7gWHvj4FDesJcjTfAY8oM3+vYMI2c/+O3wjOVSfpCgOxTzXFh9qMXw fO+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/tXvrHCsrelCqwHQuBkqjhcR6QAT/KqaZfHhYAbPR28=; b=A1e4EZ4ptiPjwuQaFnLprBeDg2i+XNml/GjumdTs/VBO9B0gPiseh+fgnaQW9O1KoK XMgEOMOjCPMPGEDiN0CePri6pQMdudyh0gugqt0IsGGWpJWJLQGYjEBykeKrPo8z6uHu d8SKr4JhXC9P9p4jcRUq1n036yc6lN/1pgiLTlkjwxEOjK8DyABuSX+BBiTZAI+9Ih8T 9bocfGcdqDg/H5FM5MVuDjNT0sZdiB/7B0XaL2pl6VH8cCbO+4WpIoo6IImtbwGJGrCT SmjbdR19HCJYyAC7F4FAsEkRD7VDAmQKqrpixhUwbIaH5bQHLnOrCd2aTseICvSM+cnR NVUQ== X-Gm-Message-State: ACrzQf0uN7XsikO7AMINEYNgxBWW/uoWQ9u4+bBRCWTSYDKzu6O8likI fU+DJS/ROnDj2T+XMnYCm5M= X-Received: by 2002:a05:6000:713:b0:232:bd2e:8620 with SMTP id bs19-20020a056000071300b00232bd2e8620mr15894482wrb.139.1666450607491; Sat, 22 Oct 2022 07:56:47 -0700 (PDT) Received: from localhost.localdomain ([117.102.55.205]) by smtp.gmail.com with ESMTPSA id s2-20020adfea82000000b002364835caacsm6213512wrm.112.2022.10.22.07.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 07:56:47 -0700 (PDT) From: Osama Muhammad To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Osama Muhammad , Samuel Thibault Subject: [PATCH v4] Accessiblity: speakup_soft: specifying the default driver parameters among the module params Date: Sat, 22 Oct 2022 19:49:49 +0500 Message-Id: <20221022144949.24473-1-osmtendev@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an enhancement which allows to specify the default driver parameters among the module parameters. Adding a 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 Reviewed-by: Samuel Thibault --- Changes since v3: - Patch reviewed by maintainer. Changes since v2: - Removed an unnecessary comment. 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. --- drivers/accessibility/speakup/speakup_soft.c | 59 ++++++++++++++------ 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/drivers/accessibility/speakup/speakup_soft.c b/drivers/accessibility/speakup/speakup_soft.c index 28c8f60370cf..6d446824677b 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[] = { - /* DIRECT is put first so that module_param_named can access it easily */ - { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, - - { CAPS_START, .u.s = {"\x01+3p" } }, - { CAPS_STOP, .u.s = {"\x01-3p" } }, - { PAUSE, .u.n = {"\x01P" } }, - { RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } }, - { PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } }, - { INFLECTION, .u.n = {"\x01%dr", 5, 0, 9, 0, 0, NULL } }, - { VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } }, - { TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } }, - { PUNCT, .u.n = {"\x01%db", 0, 0, 3, 0, 0, NULL } }, - { VOICE, .u.n = {"\x01%do", 0, 0, 7, 0, 0, NULL } }, - { FREQUENCY, .u.n = {"\x01%df", 5, 0, 9, 0, 0, NULL } }, + +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_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, + [CAPS_START_ID] = { CAPS_START, .u.s = {"\x01+3p" } }, + [CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\x01-3p" } }, + [PAUSE_ID] = { PAUSE, .u.n = {"\x01P" } }, + [RATE_ID] = { RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } }, + [PITCH_ID] = { PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } }, + [INFLECTION_ID] = { INFLECTION, .u.n = {"\x01%dr", 5, 0, 9, 0, 0, NULL } }, + [VOL_ID] = { VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } }, + [TONE_ID] = { TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } }, + [PUNCT_ID] = { PUNCT, .u.n = {"\x01%db", 0, 0, 3, 0, 0, NULL } }, + [VOICE_ID] = { VOICE, .u.n = {"\x01%do", 0, 0, 7, 0, 0, NULL } }, + [FREQUENCY_ID] = { FREQUENCY, .u.n = {"\x01%df", 5, 0, 9, 0, 0, NULL } }, V_LAST_VAR }; @@ -451,10 +460,28 @@ static int softsynth_adjust(struct spk_synth *synth, struct st_var_header *var) } module_param_named(start, synth_soft.startup, short, 0444); -module_param_named(direct, vars[0].u.n.default_val, int, 0444); +module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444); +module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444); +module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444); +module_param_named(inflection, vars[INFLECTION_ID].u.n.default_val, int, 0444); +module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444); +module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444); +module_param_named(punct, vars[PUNCT_ID].u.n.default_val, int, 0444); +module_param_named(voice, vars[VOICE_ID].u.n.default_val, int, 0444); +module_param_named(frequency, vars[FREQUENCY_ID].u.n.default_val, int, 0444); + + MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); MODULE_PARM_DESC(direct, "Set the direct variable on load."); +MODULE_PARM_DESC(rate, "Sets the rate of the synthesizer."); +MODULE_PARM_DESC(pitch, "Sets the pitch of the synthesizer."); +MODULE_PARM_DESC(inflection, "Sets the inflection of the synthesizer."); +MODULE_PARM_DESC(vol, "Sets the volume of the speech synthesizer."); +MODULE_PARM_DESC(tone, "Sets the tone of the speech synthesizer."); +MODULE_PARM_DESC(punct, "Sets the amount of punctuation spoken by the synthesizer."); +MODULE_PARM_DESC(voice, "Sets the voice used by the synthesizer."); +MODULE_PARM_DESC(frequency, "Sets the frequency of speech synthesizer."); module_spk_synth(synth_soft); -- 2.25.1