From nobody Thu Nov 14 04:49:22 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