From patchwork Fri Sep 25 09:28:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 250886 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DBFBC4363D for ; Fri, 25 Sep 2020 09:30:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0223620738 for ; Fri, 25 Sep 2020 09:30:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="rT/qRS93"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OKYztN3e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0223620738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 465E21880; Fri, 25 Sep 2020 11:29:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 465E21880 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1601026225; bh=eeYa8XoUJn6pNGbcmQB6MWOnUpL8hNgftcsGNDslVAI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rT/qRS93M63RZlTNTJHCaB3jQeb+MaxRonYyVU4fHDC7HHGYId6oqjFH5w7CaCkHE UpU90O+DbyJOfgybEju/pTvKWpbuI63Sh7xKiiUOQa71SgtU6dMxAT1uAEJwMXBTnJ 0iy/LVJR382P9sMwbyP8p05WuSGF6iXhfHJ4Jk8o= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AC05DF800F6; Fri, 25 Sep 2020 11:28:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8DE7DF8028F; Fri, 25 Sep 2020 11:28:47 +0200 (CEST) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3A402F800F6 for ; Fri, 25 Sep 2020 11:28:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3A402F800F6 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OKYztN3e" Received: by mail-wm1-x344.google.com with SMTP id y15so2516738wmi.0 for ; Fri, 25 Sep 2020 02:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ILQ/IiRKb55ppcaOHIyXL34tMQjZIAgy+EvIz2zBiIc=; b=OKYztN3emZinZ60HG3Zaxg3pQkZM8kA1HxlbgRE5GQfuunViHAro6Z7Qm7QWUpGb6y 8FF9VP4qNwZX4xi5uZzhr9ICXax2MvYohnmW6VlX0fDh45tB3Es2HX90yyDhbot9OFqn THbBv0tAzRvY/Swx6ic81ssAWbq1RPN9CVlU+M0W34WFFeUarHZMP0rXSurdxalCafWM KB2aG2JXbflkzuZyHocZjXNdvL0m5IyAZgynvGms0+w18tMFN2sKtXOjm6PmgN/TmnzW qOYe48Jp2GKuPReXYIQcpeJw9f2tMh8uj5CnNf02nDlAgkkOwTfthpPnu7p9YUerFbP2 BMsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ILQ/IiRKb55ppcaOHIyXL34tMQjZIAgy+EvIz2zBiIc=; b=I1ul+tre24n4h4loTBQPDWtIiLHYNNyzOoVHms1wZaElW+GhLMeJzZOLq7Q8iLwYS+ hcZLuDO5vxAC4Bx9NP9EclXgyvwdaVtniTJvocFOH1nK9EW8XsPyNxbUy8Onj1h0MKMf zfJ6nDeGdg4QC+DBD724PNaj6hvus7+GDYuDb9rarUa12geGV8jfyaripl5g52qLV34P ALB2tfqw5qtUzlxV7yupWDMOpv8xzJBdVp3gz4kVJbrJvlDVsux6uPMvdnEQeS+BGKl0 G0/pUlkmonT2Wv3VvRHtLgDGS2lBmtfTc+1XWC6/JmrpXG+Zqwp42XiJwVjLqMN6hoQ/ uhmw== X-Gm-Message-State: AOAM5310Kv9P6BHlKtZSzNrRrv3UAHFmeNkiXXovbR+kZ9KcEBtKyqAn kC0SeXFF8/ErbNbr8YPYBtnd5A== X-Google-Smtp-Source: ABdhPJx34N2upgwLQ/YFcj2NxUHH/0r1UvLTJ42+7TN6qcD2mAk2/oh9pZZvU4i1CGwxzOHzGSF/mw== X-Received: by 2002:a1c:5988:: with SMTP id n130mr2174411wmb.95.1601026114341; Fri, 25 Sep 2020 02:28:34 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id n2sm2366859wma.29.2020.09.25.02.28.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2020 02:28:33 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 1/2] regmap: add support to regmap_field_bulk_alloc/free apis Date: Fri, 25 Sep 2020 10:28:03 +0100 Message-Id: <20200925092804.23536-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200925092804.23536-1-srinivas.kandagatla@linaro.org> References: <20200925092804.23536-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, srivasam@codeaurora.org, lgirdwood@gmail.com, gregkh@linuxfoundation.org, rafael@kernel.org, tiwai@suse.com, rohitkr@codeaurora.org, Srinivas Kandagatla , linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Usage of regmap_field_alloc becomes much overhead when number of fields exceed more than 3. QCOM LPASS driver has extensively converted to use regmap_fileds. Using new bluk api to allocate fields makes it much more cleaner code to read! Signed-off-by: Srinivas Kandagatla Tested-by: Srinivasa Rao Mandadapu --- drivers/base/regmap/regmap.c | 100 +++++++++++++++++++++++++++++++++++ include/linux/regmap.h | 11 ++++ 2 files changed, 111 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index aec3f26bf711..271740a163ad 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1270,6 +1270,106 @@ struct regmap_field *devm_regmap_field_alloc(struct device *dev, } EXPORT_SYMBOL_GPL(devm_regmap_field_alloc); + +/** + * regmap_field_bulk_alloc() - Allocate and initialise a bulk register field. + * + * @regmap: regmap bank in which this register field is located. + * @rm_field: regmap register fileds with in the bank. + * @reg_field: Register fields with in the bank. + * @num_fields: Number of register fileds. + * + * The return value will be an -ENOMEM on error or zero for success. + * Newly allocated regmap_fields should be freed by calling + * regmap_field_bulk_free() + */ +int regmap_field_bulk_alloc(struct regmap *regmap, + struct regmap_field **rm_field, + struct reg_field *reg_field, + int num_fields) +{ + struct regmap_field *rf; + int i; + + rf = kcalloc(num_fields, sizeof(*rf), GFP_KERNEL); + if (!rf) + return -ENOMEM; + + for (i = 0; i < num_fields; i++) { + regmap_field_init(&rf[i], regmap, reg_field[i]); + rm_field[i] = &rf[i]; + } + + return 0; +} +EXPORT_SYMBOL_GPL(regmap_field_bulk_alloc); + +/** + * devm_regmap_field_bulk_alloc() - Allocate and initialise a bulk register + * fields. + * + * @dev: Device that will be interacted with + * @regmap: regmap bank in which this register field is located. + * @rm_field: regmap register fileds with in the bank. + * @reg_field: Register fields with in the bank. + * @num_fields: Number of register fileds. + * + * The return value will be an -ENOMEM on error or zero for success. + * Newly allocated regmap_fields will be automatically freed by the + * device management code. + */ +int devm_regmap_field_bulk_alloc(struct device *dev, + struct regmap *regmap, + struct regmap_field **rm_field, + struct reg_field *reg_field, + int num_fields) +{ + struct regmap_field *rf; + int i; + + rf = devm_kcalloc(dev, num_fields, sizeof(*rf), GFP_KERNEL); + if (!rf) + return -ENOMEM; + + for (i = 0; i < num_fields; i++) { + regmap_field_init(&rf[i], regmap, reg_field[i]); + rm_field[i] = &rf[i]; + } + + return 0; +} +EXPORT_SYMBOL_GPL(devm_regmap_field_bulk_alloc); + +/** + * regmap_field_bulk_free() - Free register field allocated using + * regmap_field_bulk_alloc. + * + * @field: regmap fields which should be freed. + */ +void regmap_field_bulk_free(struct regmap_field *field) +{ + kfree(field); +} +EXPORT_SYMBOL_GPL(regmap_field_bulk_free); + +/** + * devm_regmap_field_bulk_free() - Free a bulk register field allocated using + * devm_regmap_field_bulk_alloc. + * + * @dev: Device that will be interacted with + * @field: regmap field which should be freed. + * + * Free register field allocated using devm_regmap_field_bulk_alloc(). Usually + * drivers need not call this function, as the memory allocated via devm + * will be freed as per device-driver life-cyle. + */ +void devm_regmap_field_bulk_free(struct device *dev, + struct regmap_field *field) +{ + devm_kfree(dev, field); +} +EXPORT_SYMBOL_GPL(devm_regmap_field_bulk_free); + /** * devm_regmap_field_free() - Free a register field allocated using * devm_regmap_field_alloc. diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 0c49d59168b5..a35ec0a0d6e0 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1189,6 +1189,17 @@ struct regmap_field *devm_regmap_field_alloc(struct device *dev, struct regmap *regmap, struct reg_field reg_field); void devm_regmap_field_free(struct device *dev, struct regmap_field *field); +int regmap_field_bulk_alloc(struct regmap *regmap, + struct regmap_field **rm_field, + struct reg_field *reg_field, + int num_fields); +void regmap_field_bulk_free(struct regmap_field *field); +int devm_regmap_field_bulk_alloc(struct device *dev, struct regmap *regmap, + struct regmap_field **field, + struct reg_field *reg_field, int num_fields); +void devm_regmap_field_bulk_free(struct device *dev, + struct regmap_field *field); + int regmap_field_read(struct regmap_field *field, unsigned int *val); int regmap_field_update_bits_base(struct regmap_field *field, unsigned int mask, unsigned int val, From patchwork Fri Sep 25 09:28:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 291569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB12DC4363D for ; Fri, 25 Sep 2020 09:31:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3C2A206BE for ; Fri, 25 Sep 2020 09:31:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="bZ48N6KF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LNznKUHS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3C2A206BE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 34892829; Fri, 25 Sep 2020 11:30:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 34892829 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1601026270; bh=H0DMnkJkEyWkAoJo1m0n1iJGu/lBiLQLXP5joqeztT4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bZ48N6KFjiLXyck1UaUZAV3pClZynU1mYCCEI5WIl8rTxUVbh4ZJ4Ml9TWsvQnp/E dH1yqD31iC8uNtM0RI6kYMSM4Ife1yqqwceATIRyNTX1CZSInGlcqe+vMV4DXxHHGP IwRcrSBd862E3SgwuzmQ6pNI7LnsH2Pxx/sU5ips= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B9D46F802A9; Fri, 25 Sep 2020 11:28:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 92A5FF800DA; Fri, 25 Sep 2020 11:28:47 +0200 (CEST) Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8E452F800DA for ; Fri, 25 Sep 2020 11:28:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8E452F800DA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LNznKUHS" Received: by mail-wr1-x444.google.com with SMTP id z4so2822625wrr.4 for ; Fri, 25 Sep 2020 02:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9+lQmvGIW34Fed8sffLC/RmBoE8wLwQ9s9GB7PfHXuY=; b=LNznKUHScZpcbVBxTTF2/ypBWXKkc8wBM9UV9nb/DgTkEiwfxUYkczzbFEG8RkMWUX lP7MurZarRW7M0/dXDSmFrlZhe1Ow6Caz+Jl/Sj7Inx/i4+1hi22xwa+2ynB+3SA73T5 H/k7KNVtHyZNypCILFyhsCfPg9YgGLgyhZR21ACLyCTSiRDpF8+t2UDq7rtoMN4lHBba 7MqHRMod7qyO8iI7qB3pm8cmNMsnLiYwCp33yHv20vFnw9XjNZ3TMN8BDuNU8E7f3S1K mrUDYXOL9gQDlj0b+vQC7r9OgRLAMvs6dlRH/ngDAzh5stAiNr9I5z6MqTpJSmhSBC6F 05Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9+lQmvGIW34Fed8sffLC/RmBoE8wLwQ9s9GB7PfHXuY=; b=ML13oMnPwOExIQCuz4h215pYUB1WlC+ckAdtLYQe7i31NTda5OvZs6NsUEgY07YzlK PG8ZV00phIyb0i6eQdTkZgdRpCWIdvsFquQqlsZIcmjOoJOLVm8QR+nMPug39EAHSsiW E613qsFdYxpNY+orTMfXWj07MgZqBtvqmG0GkVGJ8KaLA6UmjZGx2BwtVYVUv7dzDj6q EuQGP+ol7mrwezdd2oeuL/IJsSREvoKcSCrlTGOtcV5gMGM8HrUkOj0hWcevgkc65Y3a RG539bhZXx7g7yl/fgpdT7LvOEpbbhSPMthZs8hICTawnHJz5ktxBVTfj+UWWWdu4vY5 v+Kw== X-Gm-Message-State: AOAM532zZu+MZpZeeFeKRp4zwuL5CEo+l4mri+6T0ux1YaW7Fo0kc6ve vitg8jE94SVTZTEK5WOpAOhmJg== X-Google-Smtp-Source: ABdhPJwe0tGhwlRBHQfo0XPNmflmh1mkrdlaabZjOOBmINRUpSzPw9GJzqrYNZkjHavFfPXH6KD/cQ== X-Received: by 2002:adf:9e06:: with SMTP id u6mr3515710wre.208.1601026115714; Fri, 25 Sep 2020 02:28:35 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id n2sm2366859wma.29.2020.09.25.02.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2020 02:28:35 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 2/2] ASoC: lpass-platform: use devm_regmap_field_bulk_alloc Date: Fri, 25 Sep 2020 10:28:04 +0100 Message-Id: <20200925092804.23536-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200925092804.23536-1-srinivas.kandagatla@linaro.org> References: <20200925092804.23536-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, srivasam@codeaurora.org, lgirdwood@gmail.com, gregkh@linuxfoundation.org, rafael@kernel.org, tiwai@suse.com, rohitkr@codeaurora.org, Srinivas Kandagatla , linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" use new devm_regmap_field_bulk_alloc to allocate fields as it make the code more readable! Signed-off-by: Srinivas Kandagatla Tested-by: Srinivasa Rao Mandadapu --- sound/soc/qcom/lpass-platform.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index df692ed95503..7ac26290082f 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -56,6 +56,7 @@ static int lpass_platform_alloc_dmactl_fields(struct device *dev, struct lpass_data *drvdata = dev_get_drvdata(dev); struct lpass_variant *v = drvdata->variant; struct lpaif_dmactl *rd_dmactl, *wr_dmactl; + int rval; drvdata->rd_dmactl = devm_kzalloc(dev, sizeof(struct lpaif_dmactl), GFP_KERNEL); @@ -70,31 +71,13 @@ static int lpass_platform_alloc_dmactl_fields(struct device *dev, rd_dmactl = drvdata->rd_dmactl; wr_dmactl = drvdata->wr_dmactl; - rd_dmactl->bursten = devm_regmap_field_alloc(dev, map, v->rdma_bursten); - rd_dmactl->wpscnt = devm_regmap_field_alloc(dev, map, v->rdma_wpscnt); - rd_dmactl->fifowm = devm_regmap_field_alloc(dev, map, v->rdma_fifowm); - rd_dmactl->intf = devm_regmap_field_alloc(dev, map, v->rdma_intf); - rd_dmactl->enable = devm_regmap_field_alloc(dev, map, v->rdma_enable); - rd_dmactl->dyncclk = devm_regmap_field_alloc(dev, map, v->rdma_dyncclk); + rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->bursten, + &v->rdma_bursten, 6); + if (rval) + return rval; - if (IS_ERR(rd_dmactl->bursten) || IS_ERR(rd_dmactl->wpscnt) || - IS_ERR(rd_dmactl->fifowm) || IS_ERR(rd_dmactl->intf) || - IS_ERR(rd_dmactl->enable) || IS_ERR(rd_dmactl->dyncclk)) - return -EINVAL; - - wr_dmactl->bursten = devm_regmap_field_alloc(dev, map, v->wrdma_bursten); - wr_dmactl->wpscnt = devm_regmap_field_alloc(dev, map, v->wrdma_wpscnt); - wr_dmactl->fifowm = devm_regmap_field_alloc(dev, map, v->wrdma_fifowm); - wr_dmactl->intf = devm_regmap_field_alloc(dev, map, v->wrdma_intf); - wr_dmactl->enable = devm_regmap_field_alloc(dev, map, v->wrdma_enable); - wr_dmactl->dyncclk = devm_regmap_field_alloc(dev, map, v->wrdma_dyncclk); - - if (IS_ERR(wr_dmactl->bursten) || IS_ERR(wr_dmactl->wpscnt) || - IS_ERR(wr_dmactl->fifowm) || IS_ERR(wr_dmactl->intf) || - IS_ERR(wr_dmactl->enable) || IS_ERR(wr_dmactl->dyncclk)) - return -EINVAL; - - return 0; + return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->bursten, + &v->wrdma_bursten, 6); } static int lpass_platform_pcmops_open(struct snd_soc_component *component,