From nobody Sat Sep 21 23:23:37 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 23A0FC433EF for ; Wed, 22 Jun 2022 06:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349953AbiFVGXx (ORCPT ); Wed, 22 Jun 2022 02:23:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349994AbiFVGXJ (ORCPT ); Wed, 22 Jun 2022 02:23:09 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32DF39FCE; Tue, 21 Jun 2022 23:22:57 -0700 (PDT) X-UUID: 26db0123e0c24dd29e953cfc5126be01-20220622 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.6,REQID:92e0131c-1632-4819-ba51-e39677ad1153,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACT ION:release,TS:-5 X-CID-META: VersionHash:b14ad71,CLOUDID:af4bb82d-1756-4fa3-be7f-474a6e4be921,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,QS:nil,BEC:nil,COL:0 X-UUID: 26db0123e0c24dd29e953cfc5126be01-20220622 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1397534780; Wed, 22 Jun 2022 14:22:48 +0800 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Wed, 22 Jun 2022 14:22:47 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 22 Jun 2022 14:22:47 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.3 via Frontend Transport; Wed, 22 Jun 2022 14:22:47 +0800 From: Tinghan Shen To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Daniel Baluta , "Mark Brown" , Jaroslav Kysela , Takashi Iwai , Tinghan Shen , YC Hung , Curtis Malainey , "Allen-KH Cheng" CC: , , , , , , Subject: [PATCH v4 2/4] firmware: mediatek: Use meaningful names for mbox Date: Wed, 22 Jun 2022 14:22:43 +0800 Message-ID: <20220622062245.21021-3-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220622062245.21021-1-tinghan.shen@mediatek.com> References: <20220622062245.21021-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rename mbox according to actions instead of 'mbox0' and 'mbox1' Signed-off-by: Tinghan Shen --- drivers/firmware/mtk-adsp-ipc.c | 36 +++++++++++---------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/firmware/mtk-adsp-ipc.c b/drivers/firmware/mtk-adsp-ip= c.c index cb255a99170c..3c071f814455 100644 --- a/drivers/firmware/mtk-adsp-ipc.c +++ b/drivers/firmware/mtk-adsp-ipc.c @@ -12,6 +12,8 @@ #include #include =20 +static const char * const adsp_mbox_ch_names[MTK_ADSP_MBOX_NUM] =3D { "rx"= , "tx" }; + /* * mtk_adsp_ipc_send - send ipc cmd to MTK ADSP * @@ -72,7 +74,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *pde= v) struct mtk_adsp_ipc *adsp_ipc; struct mtk_adsp_chan *adsp_chan; struct mbox_client *cl; - char *chan_name; int ret; int i, j; =20 @@ -83,12 +84,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *pd= ev) return -ENOMEM; =20 for (i =3D 0; i < MTK_ADSP_MBOX_NUM; i++) { - chan_name =3D kasprintf(GFP_KERNEL, "mbox%d", i); - if (!chan_name) { - ret =3D -ENOMEM; - goto out; - } - adsp_chan =3D &adsp_ipc->chans[i]; cl =3D &adsp_chan->cl; cl->dev =3D dev->parent; @@ -99,17 +94,20 @@ static int mtk_adsp_ipc_probe(struct platform_device *p= dev) =20 adsp_chan->ipc =3D adsp_ipc; adsp_chan->idx =3D i; - adsp_chan->ch =3D mbox_request_channel_byname(cl, chan_name); + adsp_chan->ch =3D mbox_request_channel_byname(cl, adsp_mbox_ch_names[i]); if (IS_ERR(adsp_chan->ch)) { ret =3D PTR_ERR(adsp_chan->ch); if (ret !=3D -EPROBE_DEFER) - dev_err(dev, "Failed to request mbox chan %d ret %d\n", - i, ret); - goto out_free; - } + dev_err(dev, "Failed to request mbox chan %s ret %d\n", + adsp_mbox_ch_names[i], ret); + + for (j =3D 0; j < i; j++) { + adsp_chan =3D &adsp_ipc->chans[j]; + mbox_free_channel(adsp_chan->ch); + } =20 - dev_dbg(dev, "request mbox chan %s\n", chan_name); - kfree(chan_name); + return ret; + } } =20 adsp_ipc->dev =3D dev; @@ -117,16 +115,6 @@ static int mtk_adsp_ipc_probe(struct platform_device *= pdev) dev_dbg(dev, "MTK ADSP IPC initialized\n"); =20 return 0; - -out_free: - kfree(chan_name); -out: - for (j =3D 0; j < i; j++) { - adsp_chan =3D &adsp_ipc->chans[j]; - mbox_free_channel(adsp_chan->ch); - } - - return ret; } =20 static int mtk_adsp_ipc_remove(struct platform_device *pdev) --=20 2.18.0