From nobody Thu Oct 31 02:19:11 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02D9ECE7B19 for ; Thu, 28 Sep 2023 10:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231836AbjI1K6e (ORCPT ); Thu, 28 Sep 2023 06:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231841AbjI1K63 (ORCPT ); Thu, 28 Sep 2023 06:58:29 -0400 Received: from out28-195.mail.aliyun.com (out28-195.mail.aliyun.com [115.124.28.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 238BA1A5; Thu, 28 Sep 2023 03:58:25 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.06714053|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0119606-0.00394247-0.984097;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047194;MF=wangweidong.a@awinic.com;NM=1;PH=DS;RN=30;RT=30;SR=0;TI=SMTPD_---.UqYH8mm_1695898693; Received: from ubuntu-VirtualBox..(mailfrom:wangweidong.a@awinic.com fp:SMTPD_---.UqYH8mm_1695898693) by smtp.aliyun-inc.com; Thu, 28 Sep 2023 18:58:21 +0800 From: wangweidong.a@awinic.com To: girdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, perex@perex.cz, tiwai@suse.com, wangweidong.a@awinic.com, rf@opensource.cirrus.com, shumingf@realtek.com, herve.codina@bootlin.com, rdunlap@infradead.org, 13916275206@139.com, ryans.lee@analog.com, linus.walleij@linaro.org, ckeepax@opensource.cirrus.com, doug@schmorgal.com, ajye_huang@compal.corp-partner.google.com, harshit.m.mogalapalli@oracle.com, arnd@arndb.de, yang.lee@linux.alibaba.com, u.kleine-koenig@pengutronix.de, liweilei@awinic.com, yijiangtao@awinic.com, trix@redhat.com, dan.carpenter@linaro.org, colin.i.king@gmail.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V6 05/10] ASoC: codecs: Modify the transmission method of parameters Date: Thu, 28 Sep 2023 18:57:22 +0800 Message-ID: <20230928105727.47273-6-wangweidong.a@awinic.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230928105727.47273-1-wangweidong.a@awinic.com> References: <20230928105727.47273-1-wangweidong.a@awinic.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Weidong Wang Change the transmission mode of the "aw88395_dev_get_prof_name" function parameter, Instead of using return values for data transfer, parameters are used Signed-off-by: Weidong Wang --- sound/soc/codecs/aw88395/aw88395.c | 9 ++++----- sound/soc/codecs/aw88395/aw88395_device.c | 12 ++++++++---- sound/soc/codecs/aw88395/aw88395_device.h | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/aw88395/aw88395.c b/sound/soc/codecs/aw88395/= aw88395.c index 9dcd75dd799a..77227c8f01f6 100644 --- a/sound/soc/codecs/aw88395/aw88395.c +++ b/sound/soc/codecs/aw88395/aw88395.c @@ -175,9 +175,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kc= ontrol, { struct snd_soc_component *codec =3D snd_soc_kcontrol_component(kcontrol); struct aw88395 *aw88395 =3D snd_soc_component_get_drvdata(codec); - const char *prof_name; - char *name; - int count; + char *prof_name, *name; + int count, ret; =20 uinfo->type =3D SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count =3D 1; @@ -196,8 +195,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kc= ontrol, name =3D uinfo->value.enumerated.name; count =3D uinfo->value.enumerated.item; =20 - prof_name =3D aw88395_dev_get_prof_name(aw88395->aw_pa, count); - if (!prof_name) { + ret =3D aw88395_dev_get_prof_name(aw88395->aw_pa, count, &prof_name); + if (ret) { strscpy(uinfo->value.enumerated.name, "null", strlen("null") + 1); return 0; diff --git a/sound/soc/codecs/aw88395/aw88395_device.c b/sound/soc/codecs/a= w88395/aw88395_device.c index 5ca4172cb788..fd1f67d5f22f 100644 --- a/sound/soc/codecs/aw88395/aw88395_device.c +++ b/sound/soc/codecs/aw88395/aw88395_device.c @@ -1296,7 +1296,9 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, b= ool up_dsp_fw_en, bool forc return -EPERM; } =20 - prof_name =3D aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index); + ret =3D aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name); + if (ret) + return ret; =20 dev_dbg(aw_dev->dev, "start update %s", prof_name); =20 @@ -1644,7 +1646,7 @@ int aw88395_dev_set_profile_index(struct aw_device *a= w_dev, int index) } EXPORT_SYMBOL_GPL(aw88395_dev_set_profile_index); =20 -char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index) +int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **= prof_name) { struct aw_prof_info *prof_info =3D &aw_dev->prof_info; struct aw_prof_desc *prof_desc; @@ -1652,12 +1654,14 @@ char *aw88395_dev_get_prof_name(struct aw_device *a= w_dev, int index) if ((index >=3D aw_dev->prof_info.count) || (index < 0)) { dev_err(aw_dev->dev, "index[%d] overflow count[%d]", index, aw_dev->prof_info.count); - return NULL; + return -EINVAL; } =20 prof_desc =3D &aw_dev->prof_info.prof_desc[index]; =20 - return prof_info->prof_name_list[prof_desc->id]; + *prof_name =3D prof_info->prof_name_list[prof_desc->id]; + + return 0; } EXPORT_SYMBOL_GPL(aw88395_dev_get_prof_name); =20 diff --git a/sound/soc/codecs/aw88395/aw88395_device.h b/sound/soc/codecs/a= w88395/aw88395_device.h index d32d16c89509..791c8c106557 100644 --- a/sound/soc/codecs/aw88395/aw88395_device.h +++ b/sound/soc/codecs/aw88395/aw88395_device.h @@ -181,7 +181,7 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, boo= l up_dsp_fw_en, bool forc void aw88395_dev_set_volume(struct aw_device *aw_dev, unsigned short set_v= ol); int aw88395_dev_get_prof_data(struct aw_device *aw_dev, int index, struct aw_prof_desc **prof_desc); -char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index); +int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **= prof_name); int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index); int aw88395_dev_get_profile_index(struct aw_device *aw_dev); int aw88395_dev_get_profile_count(struct aw_device *aw_dev); --=20 2.41.0