From nobody Thu Nov 14 04:53:19 2024 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 07E3B14F62; Thu, 11 Jan 2024 10:52:53 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="qk+I+0Dx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704970372; bh=AMVfzvbVKztx/7y6kdCGWvpZXOG+ZdfCsQ9HsmGMSIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qk+I+0DxAYUMmqa4SXs2yQNDEr8U9KFs2met++sPRrAGr9Sv8ukwt5HOmrMslZ1b/ C8gok5VsWBPtXV+T38iN7/ogRpLsVSWbXRN7Lb7Ut714tTRoLCRRlpfMw9GtJvcqTj fwUvnljf4hrlDGINcL0v6lLnfJ22gP2G1iYV94ya+8jhgU5a0UzBweWPJ+QGF+R7TN XJkTvLgVkz+XLA6MV/Bb5fHToJfW0gNcJysA9P0lCXXFl2enyOS3rrUltQ5JFXEXX0 s4N1UbVY+stgZdg4nG7rRkiyFH/TO78m1+9AWXJOXqsb4164xAbxlZBQ/3c0JFsvDH LidQhyG5J8XVQ== 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 21F8E3781F8E; Thu, 11 Jan 2024 10:52:51 +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 1/7] ASoC: mediatek: mt8173-afe-pcm: Convert to devm_pm_runtime_enable() Date: Thu, 11 Jan 2024 11:52:41 +0100 Message-ID: <20240111105247.117766-2-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Switch from pm_runtime_enable() to devm_pm_runtime_enable() to simplify the probe function. Signed-off-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediate= k/mt8173/mt8173-afe-pcm.c index b6291b7c811e..ea611730de9c 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c @@ -1117,11 +1117,11 @@ static int mt8173_afe_pcm_dev_probe(struct platform= _device *pdev) =20 platform_set_drvdata(pdev, afe); =20 - pm_runtime_enable(&pdev->dev); - if (!pm_runtime_enabled(&pdev->dev)) { + ret =3D devm_pm_runtime_enable(&pdev->dev); + if (ret) { ret =3D mt8173_afe_runtime_resume(&pdev->dev); if (ret) - goto err_pm_disable; + return ret; } =20 afe->reg_back_up_list =3D mt8173_afe_backup_list; @@ -1133,19 +1133,17 @@ static int mt8173_afe_pcm_dev_probe(struct platform= _device *pdev) &mtk_afe_pcm_platform, NULL, 0); if (ret) - goto err_pm_disable; + return ret; =20 comp_pcm =3D devm_kzalloc(&pdev->dev, sizeof(*comp_pcm), GFP_KERNEL); - if (!comp_pcm) { - ret =3D -ENOMEM; - goto err_pm_disable; - } + if (!comp_pcm) + return -ENOMEM; =20 ret =3D snd_soc_component_initialize(comp_pcm, &mt8173_afe_pcm_dai_component, &pdev->dev); if (ret) - goto err_pm_disable; + return ret; =20 #ifdef CONFIG_DEBUG_FS comp_pcm->debugfs_prefix =3D "pcm"; @@ -1155,7 +1153,7 @@ static int mt8173_afe_pcm_dev_probe(struct platform_d= evice *pdev) mt8173_afe_pcm_dais, ARRAY_SIZE(mt8173_afe_pcm_dais)); if (ret) - goto err_pm_disable; + return ret; =20 comp_hdmi =3D devm_kzalloc(&pdev->dev, sizeof(*comp_hdmi), GFP_KERNEL); if (!comp_hdmi) { @@ -1191,18 +1189,12 @@ static int mt8173_afe_pcm_dev_probe(struct platform= _device *pdev) =20 err_cleanup_components: snd_soc_unregister_component(&pdev->dev); -err_pm_disable: - pm_runtime_disable(&pdev->dev); return ret; } =20 static void mt8173_afe_pcm_dev_remove(struct platform_device *pdev) { snd_soc_unregister_component(&pdev->dev); - - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - mt8173_afe_runtime_suspend(&pdev->dev); } =20 static const struct of_device_id mt8173_afe_pcm_dt_match[] =3D { --=20 2.43.0 From nobody Thu Nov 14 04:53:19 2024 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 211CB14F68; Thu, 11 Jan 2024 10:52:55 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="q4kLQ0pR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704970373; bh=t5/M/FDJlEol50qHM5SqsEKoXsNv1Vb4Pkp42aLqIa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q4kLQ0pRzFTsf7+QSE8HGBiTkkbxto3GLyZ/YvnTZ3mYaGX8FfpVDoW/lCHeVEnrp KDquhySZRSotQRrNpFz7IxcBhS8HRZql2vryLjMWnFXGTsPv1mm83U4LWKVWBbFh1n kNp5Q0TsZ4yta0eBv1yrC3tqnJJTrn5uMX1BLsO1an4Om8eIsjITCVEyP2Ge9CLhXz AVRGSiVkjnfVb9kpbBfTX9kERC6Xsl8c4gwQuOo2AF/PHqrXvKSWgPTtGbCs1Hs2qQ Igi4DuQN7WY0gWzRwOnUKN+jHP27eSWNFbWSYz6lwKV+xDJIKIwqjyrKQ5zUgG2YPn TBQ7/nNSxctcA== 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 65DF93781FCB; Thu, 11 Jan 2024 10:52:52 +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 2/7] ASoC: mediatek: mt8173-afe-pcm: Use devm_snd_soc_register_component() Date: Thu, 11 Jan 2024 11:52:42 +0100 Message-ID: <20240111105247.117766-3-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Function devm_snd_soc_register_component() allocates a new struct snd_soc_component, adds components and initializes them; since this is also devm, it automatically unregisters components and frees memory upon destruction. That's exactly what we're doing in the probe function of this driver: switch to that function instead, allowing to remove the last goto and to discard the .remove_new() callback for this driver. Signed-off-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 58 +++------------------- 1 file changed, 8 insertions(+), 50 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediate= k/mt8173/mt8173-afe-pcm.c index ea611730de9c..b887e10635fe 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c @@ -1129,72 +1129,31 @@ static int mt8173_afe_pcm_dev_probe(struct platform= _device *pdev) afe->runtime_resume =3D mt8173_afe_runtime_resume; afe->runtime_suspend =3D mt8173_afe_runtime_suspend; =20 - ret =3D devm_snd_soc_register_component(&pdev->dev, - &mtk_afe_pcm_platform, - NULL, 0); + ret =3D devm_snd_soc_register_component(&pdev->dev, &mtk_afe_pcm_platform= , NULL, 0); if (ret) return ret; =20 - comp_pcm =3D devm_kzalloc(&pdev->dev, sizeof(*comp_pcm), GFP_KERNEL); - if (!comp_pcm) - return -ENOMEM; - - ret =3D snd_soc_component_initialize(comp_pcm, - &mt8173_afe_pcm_dai_component, - &pdev->dev); + ret =3D devm_snd_soc_register_component(&pdev->dev, &mt8173_afe_pcm_dai_c= omponent, + mt8173_afe_pcm_dais, + ARRAY_SIZE(mt8173_afe_pcm_dais)); if (ret) return ret; =20 -#ifdef CONFIG_DEBUG_FS - comp_pcm->debugfs_prefix =3D "pcm"; -#endif - - ret =3D snd_soc_add_component(comp_pcm, - mt8173_afe_pcm_dais, - ARRAY_SIZE(mt8173_afe_pcm_dais)); + ret =3D devm_snd_soc_register_component(&pdev->dev, &mt8173_afe_hdmi_dai_= component, + mt8173_afe_hdmi_dais, + ARRAY_SIZE(mt8173_afe_hdmi_dais)); if (ret) return ret; =20 - comp_hdmi =3D devm_kzalloc(&pdev->dev, sizeof(*comp_hdmi), GFP_KERNEL); - if (!comp_hdmi) { - ret =3D -ENOMEM; - goto err_cleanup_components; - } - - ret =3D snd_soc_component_initialize(comp_hdmi, - &mt8173_afe_hdmi_dai_component, - &pdev->dev); - if (ret) - goto err_cleanup_components; - -#ifdef CONFIG_DEBUG_FS - comp_hdmi->debugfs_prefix =3D "hdmi"; -#endif - - ret =3D snd_soc_add_component(comp_hdmi, - mt8173_afe_hdmi_dais, - ARRAY_SIZE(mt8173_afe_hdmi_dais)); - if (ret) - goto err_cleanup_components; - ret =3D devm_request_irq(afe->dev, irq_id, mt8173_afe_irq_handler, 0, "Afe_ISR_Handle", (void *)afe); if (ret) { dev_err(afe->dev, "could not request_irq\n"); - goto err_cleanup_components; + return ret; } =20 dev_info(&pdev->dev, "MT8173 AFE driver initialized.\n"); return 0; - -err_cleanup_components: - snd_soc_unregister_component(&pdev->dev); - return ret; -} - -static void mt8173_afe_pcm_dev_remove(struct platform_device *pdev) -{ - snd_soc_unregister_component(&pdev->dev); } =20 static const struct of_device_id mt8173_afe_pcm_dt_match[] =3D { @@ -1215,7 +1174,6 @@ static struct platform_driver mt8173_afe_pcm_driver = =3D { .pm =3D &mt8173_afe_pm_ops, }, .probe =3D mt8173_afe_pcm_dev_probe, - .remove_new =3D mt8173_afe_pcm_dev_remove, }; =20 module_platform_driver(mt8173_afe_pcm_driver); --=20 2.43.0 From nobody Thu Nov 14 04:53:19 2024 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 8D21214F9E; Thu, 11 Jan 2024 10:52:56 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="CNUrzbk4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704970374; bh=XtTNhQjNYRIFbYwAaKzO87OecuRQA3f4cAGt5GDFOck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CNUrzbk4r7fbiviJuXD8oxOtb3iKe5EZ6yqmDkIH8kPltzXtNMpmI4NOGq83MEVI1 4Oo7NquB7Nzi2dhpP6zLKHsiIAv4YfyQ94P04Tt7KnQHn1+6cs/B/4ujmR4GY2/chb ezNdk7jrKmWEYZYWLG6bfgIHa0EXuDHw+Quxj8Ab0WNdz0Vc6e1MUPPXwMtNqrI0+7 j99NGjV5OZp8xAq8LmRDhmiMLj2AONbdaj6D10To8MFPFOegcE7eEouWNyge8/QAJt u5G+4gBJ0vGkhi/GVWq8O4Fyk+rBpNVNLUj10ulNJgIRmVx5HdI90peUi77GUlQZPL IByK4lwVHvKtg== 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 AB3883781FCD; Thu, 11 Jan 2024 10:52:53 +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 3/7] ASoC: mediatek: mt8183-afe-pcm: Convert to devm_pm_runtime_enable() Date: Thu, 11 Jan 2024 11:52:43 +0100 Message-ID: <20240111105247.117766-4-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Switch from pm_runtime_enable() to devm_pm_runtime_enable() to simplify the probe function and remove the now useless .remove_new() callback. Signed-off-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 57 ++++++++-------------- 1 file changed, 20 insertions(+), 37 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediate= k/mt8183/mt8183-afe-pcm.c index 9e432ed9124b..d10aabf65a78 100644 --- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c +++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c @@ -1113,32 +1113,33 @@ static int mt8183_afe_pcm_dev_probe(struct platform= _device *pdev) return ret; } =20 - pm_runtime_enable(dev); + ret =3D devm_pm_runtime_enable(dev); + if (ret) + return ret; =20 /* regmap init */ afe->regmap =3D syscon_node_to_regmap(dev->parent->of_node); if (IS_ERR(afe->regmap)) { dev_err(dev, "could not get regmap from parent\n"); - ret =3D PTR_ERR(afe->regmap); - goto err_pm_disable; + return PTR_ERR(afe->regmap); } ret =3D regmap_attach_dev(dev, afe->regmap, &mt8183_afe_regmap_config); if (ret) { dev_warn(dev, "regmap_attach_dev fail, ret %d\n", ret); - goto err_pm_disable; + return ret; } =20 rstc =3D devm_reset_control_get(dev, "audiosys"); if (IS_ERR(rstc)) { ret =3D PTR_ERR(rstc); dev_err(dev, "could not get audiosys reset:%d\n", ret); - goto err_pm_disable; + return ret; } =20 ret =3D reset_control_reset(rstc); if (ret) { dev_err(dev, "failed to trigger audio reset:%d\n", ret); - goto err_pm_disable; + return ret; } =20 /* enable clock for regcache get default value from hw */ @@ -1148,7 +1149,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_d= evice *pdev) ret =3D regmap_reinit_cache(afe->regmap, &mt8183_afe_regmap_config); if (ret) { dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret); - goto err_pm_disable; + return ret; } =20 pm_runtime_put_sync(&pdev->dev); @@ -1161,10 +1162,8 @@ static int mt8183_afe_pcm_dev_probe(struct platform_= device *pdev) afe->memif_size =3D MT8183_MEMIF_NUM; afe->memif =3D devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), GFP_KERNEL); - if (!afe->memif) { - ret =3D -ENOMEM; - goto err_pm_disable; - } + if (!afe->memif) + return -ENOMEM; =20 for (i =3D 0; i < afe->memif_size; i++) { afe->memif[i].data =3D &memif_data[i]; @@ -1181,26 +1180,22 @@ static int mt8183_afe_pcm_dev_probe(struct platform= _device *pdev) afe->irqs_size =3D MT8183_IRQ_NUM; afe->irqs =3D devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), GFP_KERNEL); - if (!afe->irqs) { - ret =3D -ENOMEM; - goto err_pm_disable; - } + if (!afe->irqs) + return -ENOMEM; =20 for (i =3D 0; i < afe->irqs_size; i++) afe->irqs[i].irq_data =3D &irq_data[i]; =20 /* request irq */ irq_id =3D platform_get_irq(pdev, 0); - if (irq_id < 0) { - ret =3D irq_id; - goto err_pm_disable; - } + if (irq_id < 0) + return irq_id; =20 ret =3D 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"); - goto err_pm_disable; + return ret; } =20 /* init sub_dais */ @@ -1211,7 +1206,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_d= evice *pdev) if (ret) { dev_warn(afe->dev, "dai register i %d fail, ret %d\n", i, ret); - goto err_pm_disable; + return ret; } } =20 @@ -1220,7 +1215,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_d= evice *pdev) if (ret) { dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n", ret); - goto err_pm_disable; + return ret; } =20 afe->mtk_afe_hardware =3D &mt8183_afe_hardware; @@ -1236,7 +1231,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_d= evice *pdev) NULL, 0); if (ret) { dev_warn(dev, "err_platform\n"); - goto err_pm_disable; + return ret; } =20 ret =3D devm_snd_soc_register_component(afe->dev, @@ -1245,21 +1240,10 @@ static int mt8183_afe_pcm_dev_probe(struct platform= _device *pdev) afe->num_dai_drivers); if (ret) { dev_warn(dev, "err_dai_component\n"); - goto err_pm_disable; + return ret; } =20 - return ret; - -err_pm_disable: - pm_runtime_disable(&pdev->dev); - return ret; -} - -static void mt8183_afe_pcm_dev_remove(struct platform_device *pdev) -{ - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - mt8183_afe_runtime_suspend(&pdev->dev); + return 0; } =20 static const struct of_device_id mt8183_afe_pcm_dt_match[] =3D { @@ -1280,7 +1264,6 @@ static struct platform_driver mt8183_afe_pcm_driver = =3D { .pm =3D &mt8183_afe_pm_ops, }, .probe =3D mt8183_afe_pcm_dev_probe, - .remove_new =3D mt8183_afe_pcm_dev_remove, }; =20 module_platform_driver(mt8183_afe_pcm_driver); --=20 2.43.0 From nobody Thu Nov 14 04:53:19 2024 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/mediate= k/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) =20 /* initial audio related clock */ ret =3D 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"); =20 ret =3D devm_pm_runtime_enable(dev); if (ret) @@ -1119,38 +1117,29 @@ static int mt8183_afe_pcm_dev_probe(struct platform= _device *pdev) =20 /* regmap init */ afe->regmap =3D 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 =3D 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"); =20 rstc =3D devm_reset_control_get(dev, "audiosys"); - if (IS_ERR(rstc)) { - ret =3D 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= "); =20 ret =3D 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"); =20 /* enable clock for regcache get default value from hw */ afe_priv->pm_runtime_bypass_reg_ctl =3D true; pm_runtime_get_sync(&pdev->dev); =20 ret =3D 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"); =20 pm_runtime_put_sync(&pdev->dev); afe_priv->pm_runtime_bypass_reg_ctl =3D false; @@ -1193,30 +1182,22 @@ static int mt8183_afe_pcm_dev_probe(struct platform= _device *pdev) =20 ret =3D 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"); =20 /* init sub_dais */ INIT_LIST_HEAD(&afe->sub_dais); =20 for (i =3D 0; i < ARRAY_SIZE(dai_register_cbs); i++) { ret =3D 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); } =20 /* init dai_driver and component_driver */ ret =3D 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"); =20 afe->mtk_afe_hardware =3D &mt8183_afe_hardware; afe->memif_fs =3D mt8183_memif_fs; @@ -1229,19 +1210,15 @@ static int mt8183_afe_pcm_dev_probe(struct platform= _device *pdev) ret =3D 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"); =20 ret =3D 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"); =20 return 0; } --=20 2.43.0 From nobody Thu Nov 14 04:53:19 2024 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 AB21B156C7; Thu, 11 Jan 2024 10:52:58 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="3oiXd7rI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704970377; bh=cS3iWx2ZcmgtyFlp+ugoE4KjZQAyQugEDmx4+ox8BZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=3oiXd7rILSK3f0uwWTdD2JU3mMEjow9Z/QtutW2OSVLF0k8m17MhaC4Vbsy7UX2Q2 VVZXfDfdDqfJrp1zWxI2+Cd2O9QzjRQ0qRxsOe/v4Fw8SY8iSGtoCz2BF0yk2gpS1z Mchc8PSNkAEG2ekPrBxbX43UkQ7Pbst2eRpgdMUNEFBGAZlsFA1+XgzleMIUy0OFKb rYctpBQ7WDbxGcgErJshofpl9h2ymUXfdeGWrEr06yDpJXYaLE5dnrWavk0n55llgB HcT+nsRvhVcDkotl24VgfpyG12U7XwOFXBjvz8MJuJlpX4ZU7TOP3Z/2RWXvwLkL77 wvRHXIh+oN2gg== 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 47EB337811D1; Thu, 11 Jan 2024 10:52:56 +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 5/7] ASoC: mediatek: mt8192-afe-pcm: Convert to devm_pm_runtime_enable() Date: Thu, 11 Jan 2024 11:52:45 +0100 Message-ID: <20240111105247.117766-6-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Switch from pm_runtime_enable() to devm_pm_runtime_enable(), allowing to remove all gotos from the probe function. Signed-off-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 46 ++++++++-------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c b/sound/soc/mediate= k/mt8192/mt8192-afe-pcm.c index bdd1e91824d9..794419d16b01 100644 --- a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c +++ b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c @@ -2217,21 +2217,20 @@ static int mt8192_afe_pcm_dev_probe(struct platform= _device *pdev) return ret; } =20 - pm_runtime_enable(&pdev->dev); - if (!pm_runtime_enabled(&pdev->dev)) - goto err_pm_disable; + ret =3D devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; =20 /* regmap init */ afe->regmap =3D syscon_node_to_regmap(dev->parent->of_node); if (IS_ERR(afe->regmap)) { dev_err(dev, "could not get regmap from parent\n"); - ret =3D PTR_ERR(afe->regmap); - goto err_pm_disable; + return PTR_ERR(afe->regmap); } ret =3D regmap_attach_dev(dev, afe->regmap, &mt8192_afe_regmap_config); if (ret) { dev_warn(dev, "regmap_attach_dev fail, ret %d\n", ret); - goto err_pm_disable; + return ret; } =20 /* enable clock for regcache get default value from hw */ @@ -2241,7 +2240,7 @@ static int mt8192_afe_pcm_dev_probe(struct platform_d= evice *pdev) ret =3D regmap_reinit_cache(afe->regmap, &mt8192_afe_regmap_config); if (ret) { dev_err(dev, "regmap_reinit_cache fail, ret %d\n", ret); - goto err_pm_disable; + return ret; } =20 pm_runtime_put_sync(&pdev->dev); @@ -2254,10 +2253,8 @@ static int mt8192_afe_pcm_dev_probe(struct platform_= device *pdev) afe->memif_size =3D MT8192_MEMIF_NUM; afe->memif =3D devm_kcalloc(dev, afe->memif_size, sizeof(*afe->memif), GFP_KERNEL); - if (!afe->memif) { - ret =3D -ENOMEM; - goto err_pm_disable; - } + if (!afe->memif) + return -ENOMEM; =20 for (i =3D 0; i < afe->memif_size; i++) { afe->memif[i].data =3D &memif_data[i]; @@ -2271,26 +2268,22 @@ static int mt8192_afe_pcm_dev_probe(struct platform= _device *pdev) afe->irqs_size =3D MT8192_IRQ_NUM; afe->irqs =3D devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), GFP_KERNEL); - if (!afe->irqs) { - ret =3D -ENOMEM; - goto err_pm_disable; - } + if (!afe->irqs) + return -ENOMEM; =20 for (i =3D 0; i < afe->irqs_size; i++) afe->irqs[i].irq_data =3D &irq_data[i]; =20 /* request irq */ irq_id =3D platform_get_irq(pdev, 0); - if (irq_id < 0) { - ret =3D irq_id; - goto err_pm_disable; - } + if (irq_id < 0) + return irq_id; =20 ret =3D 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"); - goto err_pm_disable; + return ret; } =20 /* init sub_dais */ @@ -2301,7 +2294,7 @@ static int mt8192_afe_pcm_dev_probe(struct platform_d= evice *pdev) if (ret) { dev_warn(afe->dev, "dai register i %d fail, ret %d\n", i, ret); - goto err_pm_disable; + return ret; } } =20 @@ -2310,7 +2303,7 @@ static int mt8192_afe_pcm_dev_probe(struct platform_d= evice *pdev) if (ret) { dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n", ret); - goto err_pm_disable; + return ret; } =20 /* others */ @@ -2329,7 +2322,7 @@ static int mt8192_afe_pcm_dev_probe(struct platform_d= evice *pdev) &mt8192_afe_component, NULL, 0); if (ret) { dev_warn(dev, "err_platform\n"); - goto err_pm_disable; + return ret; } =20 ret =3D devm_snd_soc_register_component(&pdev->dev, @@ -2338,15 +2331,10 @@ static int mt8192_afe_pcm_dev_probe(struct platform= _device *pdev) afe->num_dai_drivers); if (ret) { dev_warn(dev, "err_dai_component\n"); - goto err_pm_disable; + return ret; } =20 return 0; - -err_pm_disable: - pm_runtime_disable(&pdev->dev); - - return ret; } =20 static void mt8192_afe_pcm_dev_remove(struct platform_device *pdev) --=20 2.43.0 From nobody Thu Nov 14 04:53:19 2024 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 443F114F81; Thu, 11 Jan 2024 10:53:00 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="CLVk0hS9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704970378; bh=3cQvnwcXHoi10LGhXXkqD+S50rLO3Wezsg1rzILzUxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CLVk0hS9qP1S0SfjosuThhHcG23RNZwo7E3I5N+W/tIuoxBDnsIj+HaMXf69ntc4i WNK7/lNLCd/XFvkNMyM/+Y7z/UEIFzf45S7zaWASQFMA88ATcBJCB+O3RSIVm23plI K/KPoRpBKcat+wzk0kK3DpfkHl4EtN3Ie+DRu0dz6W7M7TGBFOa7DlKL+PQDS9yx+7 QJSODtPQv5ASzB1zbVYuzxXnF/J1BrT78DYGqTVPr/E8mC6uEcY38yz+qCMbZyjiGw G6c78RnowRrlD36tFeMHibVHe5cJJWpeYGDXJBVTKgAxM2s+Mpa/6a8v4hMkuqMsG9 1cdHYvyEgmPcw== 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 8FB5F3781F8E; Thu, 11 Jan 2024 10:52:57 +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 6/7] ASoC: mediatek: mt8192-afe-pcm: Simplify with dev_err_probe() Date: Thu, 11 Jan 2024 11:52:46 +0100 Message-ID: <20240111105247.117766-7-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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/mediate= k/mt8192/mt8192-afe-pcm.c index 794419d16b01..7242e6a4625c 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) =20 /* reset controller to reset audio regs before regmap cache */ rstc =3D devm_reset_control_get_exclusive(dev, "audiosys"); - if (IS_ERR(rstc)) { - ret =3D 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= "); =20 ret =3D 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"); =20 ret =3D devm_pm_runtime_enable(&pdev->dev); if (ret) @@ -2223,25 +2218,21 @@ static int mt8192_afe_pcm_dev_probe(struct platform= _device *pdev) =20 /* regmap init */ afe->regmap =3D 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 =3D 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"); =20 /* enable clock for regcache get default value from hw */ afe_priv->pm_runtime_bypass_reg_ctl =3D true; pm_runtime_get_sync(&pdev->dev); =20 ret =3D 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"); =20 pm_runtime_put_sync(&pdev->dev); afe_priv->pm_runtime_bypass_reg_ctl =3D false; @@ -2281,30 +2272,22 @@ static int mt8192_afe_pcm_dev_probe(struct platform= _device *pdev) =20 ret =3D 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"); =20 /* init sub_dais */ INIT_LIST_HEAD(&afe->sub_dais); =20 for (i =3D 0; i < ARRAY_SIZE(dai_register_cbs); i++) { ret =3D 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"); } =20 /* init dai_driver and component_driver */ ret =3D 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"); =20 /* others */ afe->mtk_afe_hardware =3D &mt8192_afe_hardware; @@ -2320,19 +2303,15 @@ static int mt8192_afe_pcm_dev_probe(struct platform= _device *pdev) /* register platform */ ret =3D 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"); =20 ret =3D 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"); =20 return 0; } --=20 2.43.0 From nobody Thu Nov 14 04:53:19 2024 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 8073D15AC5; Thu, 11 Jan 2024 10:53:01 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="OumW6osQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704970379; bh=INSFLjKGWUsq8D7Gv8F3E/m7g3Zw056cbg7I8BkqRIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OumW6osQ54b6FN4QQ5pFj7u91fs0CI6pFd0zZ+wlCvnEn8f3OWOs8vW2JcClOCh2j poZAzt8E2OIhTSxn+C3TyiMlBjvTzOVJv4pUepYve7s1dvMaCxJd9BdSc10mIi+B6B cxCnVYBMpwTcPwxodsHKcKrBOICZ6SevL8dySA5jiZlwu08PnLVq7O8Lqm6s6hlfin S5WP+d/I/rwkRxQSiLcYgbTHqC14ncBil6IkuuSozoNsPG41F6tp2GaolSXnNTKiFd Xrg785MqlGJ5kEfFv/QfcNdcZuA+Wv46lp3kSj50YaTukvS0ffctf7xYZ+kEFHUMIo 8fTIVjiX9lVXw== 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 D541F3781FCB; Thu, 11 Jan 2024 10:52:58 +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 7/7] ASoC: mediatek: mt8195-afe-pcm: Drop .remove_new() callback Date: Thu, 11 Jan 2024 11:52:47 +0100 Message-ID: <20240111105247.117766-8-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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As we're calling devm_pm_runtime_enable() in the probe function of this driver we don't need to disable it on remove as that's devm managed: drop the .remove_new() callback entirely. While at it, also add the sentinel comment to the last of_device_id entry. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Trevor Wu --- sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c b/sound/soc/mediate= k/mt8195/mt8195-afe-pcm.c index 620d7ade1992..de848d872ce6 100644 --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c @@ -3193,16 +3193,9 @@ static int mt8195_afe_pcm_dev_probe(struct platform_= device *pdev) return ret; } =20 -static void mt8195_afe_pcm_dev_remove(struct platform_device *pdev) -{ - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - mt8195_afe_runtime_suspend(&pdev->dev); -} - static const struct of_device_id mt8195_afe_pcm_dt_match[] =3D { - {.compatible =3D "mediatek,mt8195-audio", }, - {}, + { .compatible =3D "mediatek,mt8195-audio" }, + { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, mt8195_afe_pcm_dt_match); =20 @@ -3218,7 +3211,6 @@ static struct platform_driver mt8195_afe_pcm_driver = =3D { .pm =3D &mt8195_afe_pm_ops, }, .probe =3D mt8195_afe_pcm_dev_probe, - .remove_new =3D mt8195_afe_pcm_dev_remove, }; =20 module_platform_driver(mt8195_afe_pcm_driver); --=20 2.43.0