From patchwork Thu Jan 11 10:52:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 761867 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C1F68C4707B for ; Thu, 11 Jan 2024 10:56:19 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CEB3514DF; Thu, 11 Jan 2024 11:56:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CEB3514DF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1704970577; bh=g3CqTRg/KAT4Jr2vA+YY1oEjG0Ahta0bW0lXZtbFTC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lX/CpLTLdwTmhG0YS0is5Pc0UM8Ie6DFc8EbGbMnREJY6U8v60LDx0I9nQPhjUjy8 ChgRJtzRkI3kM8WAh6jwGtWtBxT+loJ/PMz4mGu6068zB0N4b31rCsIPg0OBMr5egZ vlW+J454uMv7/foXWqdw0lrSliAfnIMgp2L3cvgk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 715BBF8060F; Thu, 11 Jan 2024 11:54:56 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id AB419F8060C; Thu, 11 Jan 2024 11:54:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3DFD8F804F1; Thu, 11 Jan 2024 11:53:03 +0100 (CET) Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D0163F80086 for ; Thu, 11 Jan 2024 11:52:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D0163F80086 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=z8F7gdjY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704970376; bh=g3CqTRg/KAT4Jr2vA+YY1oEjG0Ahta0bW0lXZtbFTC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z8F7gdjYXeUOMOswq9HWpzVX4f2vYR1n8DL/qeLIYB4WwkXvwzYF+O8ELMEstLl5f UW89SzvT3mrBdfaqAaF5vV4iO0v2kIjqwmSeLhpE65E4U7M75tYw8BddF2pETgpGTM wD+J4UWLTh1uDEKWoTIcKT/FcnWKRrBWx4LEZnN2niNAOJhxf/HKjNdZB+WIzy2HG8 /xz2T4YOeDeHHq+bCoqq4wUlROFNwBDbiAnCjQtVP9M0T/Ek+CZ1hTqH0LC5GHONa4 y6lZK6B2k1hgZPzGnyDKwNoIugpT4qIloud/FL7SOdtQPeUksm9o0RpWxv3MUFBvZp 8svFWuNxNfJJg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (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 madrid.collaboradmins.com (Postfix) with ESMTPSA id F2D893781FCF; Thu, 11 Jan 2024 10:52:54 +0000 (UTC) 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, ribalda@chromium.org, nicolas.ferre@microchip.com, u.kleine-koenig@pengutronix.de, kuninori.morimoto.gx@renesas.com, nfraprado@collabora.com, alsa-devel@alsa-project.org, trevor.wu@mediatek.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 4/7] ASoC: mediatek: mt8183-afe-pcm: Simplify with dev_err_probe() Date: Thu, 11 Jan 2024 11:52:44 +0100 Message-ID: <20240111105247.117766-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240111105247.117766-1-angelogioacchino.delregno@collabora.com> References: <20240111105247.117766-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Message-ID-Hash: JYVOZAOF5NYWF7O45EBRHHY3KRVV4YUL X-Message-ID-Hash: JYVOZAOF5NYWF7O45EBRHHY3KRVV4YUL X-MailFrom: angelogioacchino.delregno@collabora.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Simplify the probe function by switching error prints to return dev_err_probe(), lowering the lines count; while at it, also change some messages level from warn to error. Signed-off-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 71 ++++++++-------------- 1 file changed, 24 insertions(+), 47 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c index d10aabf65a78..bca7cb782163 100644 --- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c +++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c @@ -1108,10 +1108,8 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev) /* initial audio related clock */ ret = mt8183_init_clock(afe); - if (ret) { - dev_err(dev, "init clock error\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "init clock error\n"); ret = devm_pm_runtime_enable(dev); if (ret) @@ -1119,38 +1117,29 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev) /* regmap init */ afe->regmap = syscon_node_to_regmap(dev->parent->of_node); - if (IS_ERR(afe->regmap)) { - dev_err(dev, "could not get regmap from parent\n"); - return PTR_ERR(afe->regmap); - } + if (IS_ERR(afe->regmap)) + return dev_err_probe(dev, PTR_ERR(afe->regmap), + "could not get regmap from parent\n"); + ret = regmap_attach_dev(dev, afe->regmap, &mt8183_afe_regmap_config); - if (ret) { - dev_warn(dev, "regmap_attach_dev fail, ret %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "regmap_attach_dev fail\n"); rstc = devm_reset_control_get(dev, "audiosys"); - if (IS_ERR(rstc)) { - ret = PTR_ERR(rstc); - dev_err(dev, "could not get audiosys reset:%d\n", ret); - return ret; - } + if (IS_ERR(rstc)) + return dev_err_probe(dev, PTR_ERR(rstc), "could not get audiosys reset\n"); ret = reset_control_reset(rstc); - if (ret) { - dev_err(dev, "failed to trigger audio reset:%d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "failed to trigger audio reset\n"); /* enable clock for regcache get default value from hw */ afe_priv->pm_runtime_bypass_reg_ctl = true; pm_runtime_get_sync(&pdev->dev); ret = regmap_reinit_cache(afe->regmap, &mt8183_afe_regmap_config); - if (ret) { - dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "regmap_reinit_cache fail\n"); pm_runtime_put_sync(&pdev->dev); afe_priv->pm_runtime_bypass_reg_ctl = false; @@ -1193,30 +1182,22 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev) ret = devm_request_irq(dev, irq_id, mt8183_afe_irq_handler, IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); - if (ret) { - dev_err(dev, "could not request_irq for asys-isr\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "could not request_irq for asys-isr\n"); /* init sub_dais */ INIT_LIST_HEAD(&afe->sub_dais); for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) { ret = dai_register_cbs[i](afe); - if (ret) { - dev_warn(afe->dev, "dai register i %d fail, ret %d\n", - i, ret); - return ret; - } + if (ret) + return dev_err_probe(afe->dev, ret, "dai register i %d fail\n", i); } /* init dai_driver and component_driver */ ret = mtk_afe_combine_sub_dai(afe); - if (ret) { - dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n", - ret); - return ret; - } + if (ret) + return dev_err_probe(afe->dev, ret, "mtk_afe_combine_sub_dai fail\n"); afe->mtk_afe_hardware = &mt8183_afe_hardware; afe->memif_fs = mt8183_memif_fs; @@ -1229,19 +1210,15 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev) ret = devm_snd_soc_register_component(&pdev->dev, &mt8183_afe_component, NULL, 0); - if (ret) { - dev_warn(dev, "err_platform\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "err_platform\n"); ret = devm_snd_soc_register_component(afe->dev, &mt8183_afe_pcm_dai_component, afe->dai_drivers, afe->num_dai_drivers); - if (ret) { - dev_warn(dev, "err_dai_component\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "err_dai_component\n"); return 0; }