--- Begin Message ---
- To: "lgirdwood@xxxxxxxxx" <lgirdwood@xxxxxxxxx>, "angelogioacchino.delregno@xxxxxxxxxxxxx" <angelogioacchino.delregno@xxxxxxxxxxxxx>
- Subject: Re: [PATCH 4/5] ASoC: mediatek: mt8195-afe-pcm: Simplify with dev_err_probe()
- From: Trevor Wu (吳文良) <Trevor.Wu@xxxxxxxxxxxx>
- Date: Wed, 3 May 2023 13:24:59 +0000
- Cc: "sound-open-firmware@xxxxxxxxxxxxxxxx" <sound-open-firmware@xxxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "alsa-devel@xxxxxxxxxxxxxxxx" <alsa-devel@xxxxxxxxxxxxxxxx>, "ribalda@xxxxxxxxxxxx" <ribalda@xxxxxxxxxxxx>, "linux-mediatek@xxxxxxxxxxxxxxxxxxx" <linux-mediatek@xxxxxxxxxxxxxxxxxxx>, "u.kleine-koenig@xxxxxxxxxxxxxx" <u.kleine-koenig@xxxxxxxxxxxxxx>, YC Hung (洪堯俊) <yc.hung@xxxxxxxxxxxx>, "kai.vehmanen@xxxxxxxxxxxxxxx" <kai.vehmanen@xxxxxxxxxxxxxxx>, Chunxu Li (李春旭) <Chunxu.Li@xxxxxxxxxxxx>, "kernel@xxxxxxxxxxxxx" <kernel@xxxxxxxxxxxxx>, "pierre-louis.bossart@xxxxxxxxxxxxxxx" <pierre-louis.bossart@xxxxxxxxxxxxxxx>, Allen-KH Cheng (程冠勳) <Allen-KH.Cheng@xxxxxxxxxxxx>, "broonie@xxxxxxxxxx" <broonie@xxxxxxxxxx>, "tiwai@xxxxxxxx" <tiwai@xxxxxxxx>, "yung-chuan.liao@xxxxxxxxxxxxxxx" <yung-chuan.liao@xxxxxxxxxxxxxxx>, "ranjani.sridharan@xxxxxxxxxxxxxxx" <ranjani.sridharan@xxxxxxxxxxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, "matthias.bgg@xxxxxxxxx" <matthias.bgg@xxxxxxxxx>, "peter.ujfalusi@xxxxxxxxxxxxxxx" <peter.ujfalusi@xxxxxxxxxxxxxxx>, "daniel.baluta@xxxxxxx" <daniel.baluta@xxxxxxx>, "nicolas.ferre@xxxxxxxxxxxxx" <nicolas.ferre@xxxxxxxxxxxxx>, TingHan Shen (沈廷翰) <TingHan.Shen@xxxxxxxxxxxx>, "error27@xxxxxxxxx" <error27@xxxxxxxxx>
- In-reply-to: <20230503113413.149235-5-angelogioacchino.delregno@collabora.com>
- References: <20230503113413.149235-1-angelogioacchino.delregno@collabora.com> <20230503113413.149235-5-angelogioacchino.delregno@collabora.com>
On Wed, 2023-05-03 at 13:34 +0200, AngeloGioacchino Del Regno wrote:
>
> Shorten the probe function by switching to dev_err_probe() where
> possible.
>
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@xxxxxxxxxxxxx>
Acked-by: Trevor Wu <trevor.wu@xxxxxxxxxxxx>
> ---
> sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 45 +++++++-------------
> --
> 1 file changed, 14 insertions(+), 31 deletions(-)
>
> diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> index a54c16e0aa05..105db11eecec 100644
> --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> @@ -3062,10 +3062,8 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
> struct snd_soc_component *component;
>
> ret = of_reserved_mem_device_init(dev);
> - if (ret) {
> - dev_err(dev, "failed to assign memory region: %d\n",
> ret);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to assign
> memory region\n");
>
> ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33));
> if (ret)
> @@ -3089,24 +3087,17 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
>
> /* initial audio related clock */
> ret = mt8195_afe_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");
>
> /* 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");
>
> spin_lock_init(&afe_priv->afe_ctrl_lock);
>
> @@ -3143,30 +3134,22 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
>
> ret = devm_request_irq(dev, irq_id, mt8195_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(dev, "dai register i %d fail, ret
> %d\n",
> - i, ret);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "dai cb%i
> register fail\n", i);
> }
>
> /* init dai_driver and component_driver */
> ret = mtk_afe_combine_sub_dai(afe);
> - if (ret) {
> - dev_warn(dev, "mtk_afe_combine_sub_dai fail, ret
> %d\n",
> - ret);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret,
> "mtk_afe_combine_sub_dai fail\n");
>
> afe->mtk_afe_hardware = &mt8195_afe_hardware;
> afe->memif_fs = mt8195_memif_fs;
> --
> 2.40.1
>
>
--- End Message ---