[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1jy1nio9yo.fsf@starbuckisacylon.baylibre.com>
Date: Mon, 27 Mar 2023 10:45:44 +0200
From: Jerome Brunet <jbrunet@...libre.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Kevin Hilman <khilman@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
alsa-devel@...a-project.org, linux-arm-kernel@...ts.infradead.org,
linux-amlogic@...ts.infradead.org
Subject: Re: [PATCH] ASoC: meson: Use the devm_clk_get_optional() helper
On Sun 26 Mar 2023 at 14:43, Christophe JAILLET <christophe.jaillet@...adoo.fr> wrote:
> Use devm_clk_get_optional() instead of hand writing it.
> This saves some loC and improves the semantic.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Thx.
Reviewed-by: Jerome Brunet <jbrunet@...libre.com>
> ---
> sound/soc/meson/axg-tdm-interface.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c
> index 7624aafe9009..5e5e4c56d505 100644
> --- a/sound/soc/meson/axg-tdm-interface.c
> +++ b/sound/soc/meson/axg-tdm-interface.c
> @@ -496,7 +496,7 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct snd_soc_dai_driver *dai_drv;
> struct axg_tdm_iface *iface;
> - int ret, i;
> + int i;
>
> iface = devm_kzalloc(dev, sizeof(*iface), GFP_KERNEL);
> if (!iface)
> @@ -533,14 +533,9 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)
> * At this point, ignore the error if mclk is missing. We'll
> * throw an error if the cpu dai is master and mclk is missing
> */
> - iface->mclk = devm_clk_get(dev, "mclk");
> - if (IS_ERR(iface->mclk)) {
> - ret = PTR_ERR(iface->mclk);
> - if (ret == -ENOENT)
> - iface->mclk = NULL;
> - else
> - return dev_err_probe(dev, ret, "failed to get mclk\n");
> - }
> + iface->mclk = devm_clk_get_optional(dev, "mclk");
> + if (IS_ERR(iface->mclk))
> + return dev_err_probe(dev, PTR_ERR(iface->mclk), "failed to get mclk\n");
>
> return devm_snd_soc_register_component(dev,
> &axg_tdm_iface_component_drv, dai_drv,
Powered by blists - more mailing lists