From: Justin Stitt <justinstitt@google.com>
To: Jerome Brunet <jbrunet@baylibre.com>
Cc: Mark Brown <broonie@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Kevin Hilman <khilman@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH v2 1/2] ASoC: meson: aiu: fix function pointer type mismatch
Date: Wed, 14 Feb 2024 00:22:57 +0000 [thread overview]
Message-ID: <20240214002257.bfp6wk5j3wsaq6f6@google.com> (raw)
In-Reply-To: <20240213215807.3326688-2-jbrunet@baylibre.com>
Hi,
On Tue, Feb 13, 2024 at 10:58:03PM +0100, Jerome Brunet wrote:
> clang-16 warns about casting functions to incompatible types, as is done
> here to call clk_disable_unprepare:
>
> sound/soc/meson/aiu.c:243:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
> 243 | (void(*)(void *))clk_disable_unprepare,
>
> The pattern of getting, enabling and setting a disable callback for a
> clock can be replaced with devm_clk_get_enabled(), which also fixes
> this warning.
>
> Fixes: 6ae9ca9ce986 ("ASoC: meson: aiu: add i2s and spdif support")
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Silences the warning and makes the code more readable without adding any
new helpers. Awesome!
Reviewed-by: Justin Stitt <justinstitt@google.com>
> ---
> sound/soc/meson/aiu.c | 19 ++++---------------
> sound/soc/meson/aiu.h | 1 -
> 2 files changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c
> index 7109b81cc3d0..5d1419ed7a62 100644
> --- a/sound/soc/meson/aiu.c
> +++ b/sound/soc/meson/aiu.c
> @@ -212,11 +212,12 @@ static const char * const aiu_spdif_ids[] = {
> static int aiu_clk_get(struct device *dev)
> {
> struct aiu *aiu = dev_get_drvdata(dev);
> + struct clk *pclk;
> int ret;
>
> - aiu->pclk = devm_clk_get(dev, "pclk");
> - if (IS_ERR(aiu->pclk))
> - return dev_err_probe(dev, PTR_ERR(aiu->pclk), "Can't get the aiu pclk\n");
> + pclk = devm_clk_get_enabled(dev, "pclk");
> + if (IS_ERR(pclk))
> + return dev_err_probe(dev, PTR_ERR(pclk), "Can't get the aiu pclk\n");
>
> aiu->spdif_mclk = devm_clk_get(dev, "spdif_mclk");
> if (IS_ERR(aiu->spdif_mclk))
> @@ -233,18 +234,6 @@ static int aiu_clk_get(struct device *dev)
> if (ret)
> return dev_err_probe(dev, ret, "Can't get the spdif clocks\n");
>
> - ret = clk_prepare_enable(aiu->pclk);
> - if (ret) {
> - dev_err(dev, "peripheral clock enable failed\n");
> - return ret;
> - }
> -
> - ret = devm_add_action_or_reset(dev,
> - (void(*)(void *))clk_disable_unprepare,
> - aiu->pclk);
> - if (ret)
> - dev_err(dev, "failed to add reset action on pclk");
> -
> return ret;
> }
>
> diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h
> index 393b6c2307e4..0f94c8bf6081 100644
> --- a/sound/soc/meson/aiu.h
> +++ b/sound/soc/meson/aiu.h
> @@ -33,7 +33,6 @@ struct aiu_platform_data {
> };
>
> struct aiu {
> - struct clk *pclk;
> struct clk *spdif_mclk;
> struct aiu_interface i2s;
> struct aiu_interface spdif;
> --
> 2.43.0
>
Thanks
Justin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2024-02-14 0:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 21:58 [PATCH v2 0/2] ASoC: meson: aiu: fix function pointer type mismatch Jerome Brunet
2024-02-13 21:58 ` [PATCH v2 1/2] " Jerome Brunet
2024-02-14 0:22 ` Justin Stitt [this message]
2024-02-13 21:58 ` [PATCH v2 2/2] ASoC: meson: t9015: " Jerome Brunet
2024-02-14 0:27 ` Justin Stitt
2024-02-14 13:22 ` [PATCH v2 0/2] ASoC: meson: aiu: " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240214002257.bfp6wk5j3wsaq6f6@google.com \
--to=justinstitt@google.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=lgirdwood@gmail.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=martin.blumenstingl@googlemail.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=neil.armstrong@linaro.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox