Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1631431lql; Wed, 13 Mar 2024 04:02:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+EFhE29I5dWHEMlJaJ0cvgKwBIILZesSqjlxRA81MdtcstOkkQgWnMt5AXRT6S8vL3uHxul+LzgssrQAukofh8RtEPmqjm7ydRoQhzg== X-Google-Smtp-Source: AGHT+IH4uXhnuhBXvMDdPGiT7rgKpnlqhDbMT+dtNF9zQGTnRATDjy9ypgSNlQxcLHFUUm8UODTz X-Received: by 2002:a50:ab19:0:b0:565:7edf:41b0 with SMTP id s25-20020a50ab19000000b005657edf41b0mr2260836edc.6.1710327761086; Wed, 13 Mar 2024 04:02:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710327761; cv=pass; d=google.com; s=arc-20160816; b=qv4SC5iPXnnvNeTT+v1Xs36DkFnuADWgLFLUEvdVKaYXmlMqRte5t1oQVA5crPi3UL o//EBrVltq7WcEwxMZodwZV4rncC7dg6nxycX3JKorifLWD03oooUZVT6okR1hx7ewbd uOhwjg1JEQyCfMhfvqG4C7FszVmBLx3LdowYHlp6jCBOy6IIPZD2WnlEEMLjiegkJ7yg mXVp8lSNa8dySt8k32m8Xhz5l/lTrKyqPLoMOe4kW032RQPao74YNq2eeaM5yj4zih8v 4TPp20TVIn9XN4y/VMa8xhoN7hOwN8KvMd9Au+go+IzwDpl3FN3bBsrAh/Vp7/7JX1hu I8RQ== ARC-Message-Signature: i=2; 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=s7LGHGr2Wp71bsFfX1o/4ts7SBmKrZJaWPOGb4Pt9Ro=; fh=9iEt4iCRn9CzCxci4w2sdEG90CBf9Xi5ef9RsAZByLs=; b=beS5WXeCL3AKSgKNc46cQ1sgaIynJoxPyT4DxCdY9wUdAFWhx2kZJi+ewVMnM67Hhq Vq9O+57nOOLqovr/zKjQGISCCPpz/t8bauBOhWECQO5eX2L4EyrMWx6Q5CF4Mi/W4VBK aGMxeNb/OuHi1iS1EK3PBpWU3M8deAYLw/KwJT6PDVqfiP1QxNMuw0/l/1cVemUa4/lO xVpAfKDx5CalWTULSNoAIyAErQG6mnxaXXGB9rE4i9QIiNeEuv9IObuN88igIhMQ/g+v 2gYRSAj0ixvGk00mg7Y9RlssEq/Bg8rLPSVJZrnkAOHsnYsyB1f0g0nI6x74mnflxzRc 2e4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nBdF3YHv; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-101382-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101382-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bl5-20020a056402210500b0056765546aa8si4401971edb.220.2024.03.13.04.02.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 04:02:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101382-linux.lists.archive=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=nBdF3YHv; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-101382-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101382-linux.lists.archive=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 98A751F21EFF for ; Wed, 13 Mar 2024 11:02:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43CF13F9C8; Wed, 13 Mar 2024 11:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="nBdF3YHv" 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 B95E43EA66; Wed, 13 Mar 2024 11:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710327725; cv=none; b=hra//AeTwedwoPOlCDNlltK1RFGqR+pF6T/mJrebzHriN36qQ6vY7BCj0omRF+U/UcpDYEWpnyXreuxbWBpmDfjmUIRgAzFNcCW5CGe6ovzqod+NgBeJmVSf2v080MU4JqGhuAStva/lXAVX1adrASWYISd86G21AE+EwNOIICE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710327725; c=relaxed/simple; bh=BDE29d7L8T5qLbPM3CF8LepTtXCFcdT0QPMlGf+kalQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eoXmil4lV95q4ghL/uBlEcsmJYWJkQdicKLjo879oD7cS9+RBo1NiqN44WfOkQ66mjj3jUcxxzPUza7vFKbQMf+DYbU8dNsaPwtcdQ961Nri8QXCwgIRB2Z3iuNsJqj1/zX2Zl+WH37eNLkel4GOU901k7RnU2QTv0YVOxkOhXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=nBdF3YHv; arc=none smtp.client-ip=46.235.227.194 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=1710327722; bh=BDE29d7L8T5qLbPM3CF8LepTtXCFcdT0QPMlGf+kalQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBdF3YHvNGmQzwoV0kbankS1NzipRVe4266jhzK1nyFUyZ/LneRdT1s3dBkqwwhST zyRMYjKQqctKHulgIW0s6tvz/tjikjbhudMcQkeM6anvuh02Tgd0a0kEBFGsguDcV2 sYaJnq9DG5UDdetQ66A2E7JCQTjelRSbQt+YG8hzM1k83vAPMT0h6Fh4GJnCKLuQUU kqRxVbdGT47YHKjMMJGrcERjNT6e6GuB3N8gmyUT4yaPEhMleYuW7swtC3bMkN9OZa l5iFw675AcSpaWLxJ5aacKIGLpdFfR/abm00fzMZQeR783BFdxBfJI95SCrW67lzpA KgLh1xU0A+jEQ== 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 1DB2B37820D0; Wed, 13 Mar 2024 11:02:00 +0000 (UTC) From: AngeloGioacchino Del Regno To: broonie@kernel.org Cc: wenst@chromium.org, lgirdwood@gmail.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, perex@perex.cz, tiwai@suse.com, trevor.wu@mediatek.com, maso.huang@mediatek.com, xiazhengqiao@huaqin.corp-partner.google.com, arnd@arndb.de, kuninori.morimoto.gx@renesas.com, shraash@google.com, amergnat@baylibre.com, nicolas.ferre@microchip.com, u.kleine-koenig@pengutronix.de, dianders@chromium.org, frank.li@vivo.com, allen-kh.cheng@mediatek.com, eugen.hristev@collabora.com, claudiu.beznea@tuxon.dev, jarkko.nikula@bitmer.com, jiaxin.yu@mediatek.com, alpernebiyasak@gmail.com, ckeepax@opensource.cirrus.com, zhourui@huaqin.corp-partner.google.com, nfraprado@collabora.com, alsa-devel@alsa-project.org, shane.chien@mediatek.com, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com, AngeloGioacchino Del Regno Subject: [PATCH v3 02/22] ASoC: mediatek: mt8192-afe-pcm: Simplify with dev_err_probe() Date: Wed, 13 Mar 2024 12:01:27 +0100 Message-ID: <20240313110147.1267793-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313110147.1267793-1-angelogioacchino.delregno@collabora.com> References: <20240313110147.1267793-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 Content-Transfer-Encoding: 8bit Simplify the probe function by switching error prints to return dev_err_probe(), lowering the lines count; while at it, also beautify some messages and change some others' level from warn to error. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 65 ++++++++-------------- 1 file changed, 22 insertions(+), 43 deletions(-) diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c index 794419d16b01..aed22baef9fb 100644 --- a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c +++ b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c @@ -2205,17 +2205,12 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) /* reset controller to reset audio regs before regmap cache */ rstc = devm_reset_control_get_exclusive(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"); ret = devm_pm_runtime_enable(&pdev->dev); if (ret) @@ -2223,25 +2218,21 @@ static int mt8192_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"); + ret = regmap_attach_dev(dev, afe->regmap, &mt8192_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"); /* 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, &mt8192_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; @@ -2281,30 +2272,22 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) ret = devm_request_irq(dev, irq_id, mt8192_afe_irq_handler, IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); - if (ret) { - dev_err(dev, "could not request_irq for Afe_ISR_Handle\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "could not request_irq for Afe_ISR_Handle\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 %d register fail", 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"); /* others */ afe->mtk_afe_hardware = &mt8192_afe_hardware; @@ -2320,19 +2303,15 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev) /* register platform */ ret = devm_snd_soc_register_component(&pdev->dev, &mt8192_afe_component, NULL, 0); - if (ret) { - dev_warn(dev, "err_platform\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Couldn't register AFE component\n"); ret = devm_snd_soc_register_component(&pdev->dev, &mt8192_afe_pcm_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, "Couldn't register AFE-PCM component\n"); return 0; } -- 2.44.0