[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <03ab5c75083baed351bdb64c6501bfd3db33289f.camel@mediatek.com>
Date: Wed, 3 May 2023 13:24:59 +0000
From: Trevor Wu (吳文良) <Trevor.Wu@...iatek.com>
To: "lgirdwood@...il.com" <lgirdwood@...il.com>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>
CC: "sound-open-firmware@...a-project.org"
<sound-open-firmware@...a-project.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"ribalda@...omium.org" <ribalda@...omium.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"u.kleine-koenig@...gutronix.de" <u.kleine-koenig@...gutronix.de>,
YC Hung (洪堯俊) <yc.hung@...iatek.com>,
"kai.vehmanen@...ux.intel.com" <kai.vehmanen@...ux.intel.com>,
Chunxu Li (李春旭) <Chunxu.Li@...iatek.com>,
"kernel@...labora.com" <kernel@...labora.com>,
"pierre-louis.bossart@...ux.intel.com"
<pierre-louis.bossart@...ux.intel.com>,
Allen-KH Cheng (程冠勳)
<Allen-KH.Cheng@...iatek.com>,
"broonie@...nel.org" <broonie@...nel.org>,
"tiwai@...e.com" <tiwai@...e.com>,
"yung-chuan.liao@...ux.intel.com" <yung-chuan.liao@...ux.intel.com>,
"ranjani.sridharan@...ux.intel.com"
<ranjani.sridharan@...ux.intel.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"peter.ujfalusi@...ux.intel.com" <peter.ujfalusi@...ux.intel.com>,
"perex@...ex.cz" <perex@...ex.cz>,
"daniel.baluta@....com" <daniel.baluta@....com>,
"nicolas.ferre@...rochip.com" <nicolas.ferre@...rochip.com>,
TingHan Shen (沈廷翰)
<TingHan.Shen@...iatek.com>,
"error27@...il.com" <error27@...il.com>
Subject: Re: [PATCH 4/5] ASoC: mediatek: mt8195-afe-pcm: Simplify with
dev_err_probe()
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@...labora.com>
Acked-by: Trevor Wu <trevor.wu@...iatek.com>
> ---
> 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
>
>
Powered by blists - more mailing lists