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: 187294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1362859dyi; Thu, 11 Jan 2024 02:54:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEc19SBEzKP4bqXXIME6pbKXmKLKV+5CNa2czVHPob81Y3epUBeU/E0ECYDKtl7Cn+KpH+5 X-Received: by 2002:a05:6402:1c8c:b0:557:5162:a9ea with SMTP id cy12-20020a0564021c8c00b005575162a9eamr238812edb.117.1704970477464; Thu, 11 Jan 2024 02:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704970477; cv=none; d=google.com; s=arc-20160816; b=Qrc4sMh9Th/Qm5Tq6uXKWz210wgRoFG3FYXJvz2IqRvCegVPemdF1UsbOAL2IB2Iju w0eNcBADxq5gFmvmNpBbs8EpkfV0m9vBpdf42gpOiu6OA6q0KtEMtDanF+4kEy5Yu+wJ pTZhzXxo9u4km7kMOvDnAFlGE1CRCpQqsFoJy4JhiK6Akvs+k0BNfrvtpLH4yanZWwgL j0atiUM1EO10D23HP8XhImMYMg/TESMeGePPWp69L10Rx8M6upQ1CvxAJf5GIbmIicgO BuKKi+4B5Sjn9RJzk4aixasV5YW1AaPKjOX6yHage51qvUSjbxoFQVIhnRhXipBd0rOq aiKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lOl7fWc4WUggYE3srb3p8VMJWtSWR88hUf7Ithr1xR0=; fh=CUSLW4jgLN56Ew8AjCIrFKTaoeZ27cJOZmkfMWo61nk=; b=jPND7LVCtxlTr3MFwUI22zMYcOYr5FKcUeXkKrhinrnDelDZ6oilAmR19LfL5Y/GAs EuGglfYWWmmIJct7cHRmA+xIQZ/BzTYgc84yFgmzVe4dC9+nKiTMagT5vfgKLj0+6QQq 9Y6lO2lSUxMhLbQWEGNPpKGMZic6n0jmekSxtqLkKmJHKU1Bc21Ejo5wpotBQBUhwVsv WdSjSKXPC/cvmHiVXFqT9Wnwr5f4r1jQq2yG1fVag4slUJDadGBbDfeXD08W8mpQFoX5 qOGQcXcQsRXjeW3sKaKVZaEV30T8hwpNz82hwKAuzunuGmiGrkgSKZMgfgEhKCk1TGMu f5RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=z8F7gdjY; spf=pass (google.com: domain of linux-kernel+bounces-23420-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23420-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l6-20020aa7c306000000b00553fca4a42dsi418812edq.669.2024.01.11.02.54.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 02:54:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23420-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=z8F7gdjY; spf=pass (google.com: domain of linux-kernel+bounces-23420-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23420-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E8E911F2440B for ; Thu, 11 Jan 2024 10:54:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D00E15AEB; Thu, 11 Jan 2024 10:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="z8F7gdjY" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8FC1156C9; Thu, 11 Jan 2024 10:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787791123145875172 X-GMAIL-MSGID: 1787791123145875172 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; }