From patchwork Wed May 3 11:34:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 89721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1263476vqo; Wed, 3 May 2023 04:50:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KMsArUwwy1OePuV2tSj+ywOOz5aVmKpxTb3UKI4/o+HtfpEm3PG1i0DFiPXCCEPuFcOHA X-Received: by 2002:a17:903:41c4:b0:1a6:e58f:8aee with SMTP id u4-20020a17090341c400b001a6e58f8aeemr1778476ple.65.1683114619142; Wed, 03 May 2023 04:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683114619; cv=none; d=google.com; s=arc-20160816; b=eVr98gRiZJXgpJUsX/okmjICYfK5Or1CuRmBhIStnega+NRHvshGHARD3Tmhz6HfDE 6vbwsBP5nOj5NT45E7U+U4tu14fFtZYfujoUyhxK78z11uz2ZBJtWXs3WiLw2CJREXI2 poIFuFRn32M4pEz5yn+5K+dNPYm1uHK3VNUrh/8i1h8jervLmOf9JqHWr2o4XRryX/9C oS3Q7G1oiCSX66LAQpfzF4aU9LB52PALh3amLkdacAK5LXGzA3Qj4NENxKf169pgW4xz nCK4MI2UdICVDY3R2yQXlSo6F27vTLdz6pXdsB5TicmcSZP/eId53Byw8NWlzRwftVRp GYmg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DHPLzKmBsUm9HQgDoTgBtcEUS4EMTLqMPq94LXx/M/c=; b=RcdcopfRG4DlQdsHiwy1XqZwU4hBcjQBt2Dil7AxNeeOTJcgvx3H8xETAW3IkUZ6uy ErbfieRNqp3q1unsYVf8Kh4JxuVM+YJqC2nKNXtwOUlgzXub88hrd90UQNDsK/vmvSVR bTY2+iVtrlNCGojWd9l4iI/xDW428QWsja/51hkbanpKsLHnvR6CGmHOiXFxTjQXvi9S yCcQufUtytcfiC/LheqxCYyRmn7rZJANfWhGUk7/mgggJpyToRgzPd6kuwmlSijP7tUH A87n65w+8Oshyn/SFpQThwfLf0GCAxiBAfgt1UkS6eDILo9TIGDVTI0xlbNLDX55puTY xnvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="LJB0T/0i"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170902c41000b001a9b4bda723si3103149plk.421.2023.05.03.04.50.04; Wed, 03 May 2023 04:50:19 -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=@collabora.com header.s=mail header.b="LJB0T/0i"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbjECLed (ORCPT + 99 others); Wed, 3 May 2023 07:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbjECLe0 (ORCPT ); Wed, 3 May 2023 07:34:26 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A97449EC for ; Wed, 3 May 2023 04:34:25 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:c5f8:7372:f042:90a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 797F266056CE; Wed, 3 May 2023 12:34:22 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683113663; bh=L39f0aIGeOnQPRMtTubkebioIWUYydMxDfJeYgCV4k0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJB0T/0iHKJUrGdMcxKrOMKcwBeIRmFsrMfUR+fGgA+VlJT4FAhaa8QDVQSsfZzH1 HmD6uIVi4pUAE9Crl0yTwgVPK7eFAqnf4f4RZcZ9tGQp6Ol3CprXYGZxOjSydK1amL unew7PpOHyq082BVucjyF89Ukx5JEiCDyQelNqF9GHhrLO/CXbbNOm28rWQvC924JM VvBBK2VAXHlek50LaoirqagFS+McddJfCHVgZH1/NBGiF979ZdIQv3rxRNfsjWAcl1 46/w1s0Kx7odsvmZr8dlWqdCrBQHNnhOL8k0DhoWryOIRoH4kQHk4Ct4GZAZrH4iip pKOjoz3LpptjA== From: AngeloGioacchino Del Regno To: lgirdwood@gmail.com Cc: broonie@kernel.org, perex@perex.cz, tiwai@suse.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, pierre-louis.bossart@linux.intel.com, peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, daniel.baluta@nxp.com, nicolas.ferre@microchip.com, u.kleine-koenig@pengutronix.de, chunxu.li@mediatek.com, tinghan.shen@mediatek.com, error27@gmail.com, ribalda@chromium.org, yc.hung@mediatek.com, Allen-KH.Cheng@mediatek.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 2/5] ASoC: SOF: mediatek: mt8186: Use snd_sof_ipc_process_reply() helper Date: Wed, 3 May 2023 13:34:10 +0200 Message-Id: <20230503113413.149235-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230503113413.149235-1-angelogioacchino.delregno@collabora.com> References: <20230503113413.149235-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764873594694350313?= X-GMAIL-MSGID: =?utf-8?q?1764873594694350313?= Function mt8186_get_reply() performs practically the same operation as the common snd_sof_ipc_get_reply() helper: removing the custom function allows us to simply perform a call to the sof-priv helper snd_sof_ipc_process_reply(), simplifying and shortening this driver and getting all the benefits of using a common API. Signed-off-by: AngeloGioacchino Del Regno --- sound/soc/sof/mediatek/mt8186/mt8186.c | 36 +------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index 597cb4476acb..419913c8474d 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -48,47 +48,13 @@ static int mt8186_send_msg(struct snd_sof_dev *sdev, return mtk_adsp_ipc_send(priv->dsp_ipc, MTK_ADSP_IPC_REQ, MTK_ADSP_IPC_OP_REQ); } -static void mt8186_get_reply(struct snd_sof_dev *sdev) -{ - struct snd_sof_ipc_msg *msg = sdev->msg; - struct sof_ipc_reply reply; - int ret = 0; - - if (!msg) { - dev_warn(sdev->dev, "unexpected ipc interrupt\n"); - return; - } - - /* get reply */ - sof_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply)); - if (reply.error < 0) { - memcpy(msg->reply_data, &reply, sizeof(reply)); - ret = reply.error; - } else { - /* reply has correct size? */ - if (reply.hdr.size != msg->reply_size) { - dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n", - msg->reply_size, reply.hdr.size); - ret = -EINVAL; - } - - /* read the message */ - if (msg->reply_size > 0) - sof_mailbox_read(sdev, sdev->host_box.offset, - msg->reply_data, msg->reply_size); - } - - msg->reply_error = ret; -} - static void mt8186_dsp_handle_reply(struct mtk_adsp_ipc *ipc) { struct adsp_priv *priv = mtk_adsp_ipc_get_data(ipc); unsigned long flags; spin_lock_irqsave(&priv->sdev->ipc_lock, flags); - mt8186_get_reply(priv->sdev); - snd_sof_ipc_reply(priv->sdev, 0); + snd_sof_ipc_process_reply(priv->sdev, 0); spin_unlock_irqrestore(&priv->sdev->ipc_lock, flags); }