* [PATCH v2 0/2] ASoC: meson: aiu: fix function pointer type mismatch
@ 2024-02-13 21:58 Jerome Brunet
2024-02-13 21:58 ` [PATCH v2 1/2] " Jerome Brunet
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jerome Brunet @ 2024-02-13 21:58 UTC (permalink / raw)
To: Mark Brown
Cc: Jerome Brunet, Arnd Bergmann, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Neil Armstrong, Kevin Hilman, Martin Blumenstingl,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
alsa-devel, linux-sound, linux-arm-kernel, linux-amlogic,
linux-kernel, llvm
This patchset fixes 2 -Wcast-function-type-strict warning in amlogic
audio drivers with clang 16.
Changes since v1: [0]
* use devm_clk_get_enabled() instead of adding a dedicated helper in each
driver.
* Split the patch, 1 per fixed commit to make it easier for stable.
[0]: https://lore.kernel.org/lkml/20240213101220.459641-1-arnd@kernel.org/
Jerome Brunet (2):
ASoC: meson: aiu: fix function pointer type mismatch
ASoC: meson: t9015: fix function pointer type mismatch
sound/soc/meson/aiu.c | 19 ++++---------------
sound/soc/meson/aiu.h | 1 -
sound/soc/meson/t9015.c | 20 ++++----------------
3 files changed, 8 insertions(+), 32 deletions(-)
--
2.43.0
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] ASoC: meson: aiu: fix function pointer type mismatch
2024-02-13 21:58 [PATCH v2 0/2] ASoC: meson: aiu: fix function pointer type mismatch Jerome Brunet
@ 2024-02-13 21:58 ` Jerome Brunet
2024-02-14 0:22 ` Justin Stitt
2024-02-13 21:58 ` [PATCH v2 2/2] ASoC: meson: t9015: " Jerome Brunet
2024-02-14 13:22 ` [PATCH v2 0/2] ASoC: meson: aiu: " Mark Brown
2 siblings, 1 reply; 6+ messages in thread
From: Jerome Brunet @ 2024-02-13 21:58 UTC (permalink / raw)
To: Mark Brown
Cc: Jerome Brunet, Arnd Bergmann, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Neil Armstrong, Kevin Hilman, Martin Blumenstingl,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
alsa-devel, linux-sound, linux-arm-kernel, linux-amlogic,
linux-kernel, llvm
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>
---
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
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] ASoC: meson: t9015: fix function pointer type mismatch
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-13 21:58 ` Jerome Brunet
2024-02-14 0:27 ` Justin Stitt
2024-02-14 13:22 ` [PATCH v2 0/2] ASoC: meson: aiu: " Mark Brown
2 siblings, 1 reply; 6+ messages in thread
From: Jerome Brunet @ 2024-02-13 21:58 UTC (permalink / raw)
To: Mark Brown
Cc: Jerome Brunet, Arnd Bergmann, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Neil Armstrong, Kevin Hilman, Martin Blumenstingl,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
alsa-devel, linux-sound, linux-arm-kernel, linux-amlogic,
linux-kernel, llvm
clang-16 warns about casting functions to incompatible types, as is done
here to call clk_disable_unprepare:
sound/soc/meson/t9015.c:274:4: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
274 | (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: 33901f5b9b16 ("ASoC: meson: add t9015 internal DAC driver")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
sound/soc/meson/t9015.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/sound/soc/meson/t9015.c b/sound/soc/meson/t9015.c
index 9c6b4dac6893..571f65788c59 100644
--- a/sound/soc/meson/t9015.c
+++ b/sound/soc/meson/t9015.c
@@ -48,7 +48,6 @@
#define POWER_CFG 0x10
struct t9015 {
- struct clk *pclk;
struct regulator *avdd;
};
@@ -249,6 +248,7 @@ static int t9015_probe(struct platform_device *pdev)
struct t9015 *priv;
void __iomem *regs;
struct regmap *regmap;
+ struct clk *pclk;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -256,26 +256,14 @@ static int t9015_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, priv);
- priv->pclk = devm_clk_get(dev, "pclk");
- if (IS_ERR(priv->pclk))
- return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get core clock\n");
+ pclk = devm_clk_get_enabled(dev, "pclk");
+ if (IS_ERR(pclk))
+ return dev_err_probe(dev, PTR_ERR(pclk), "failed to get core clock\n");
priv->avdd = devm_regulator_get(dev, "AVDD");
if (IS_ERR(priv->avdd))
return dev_err_probe(dev, PTR_ERR(priv->avdd), "failed to AVDD\n");
- ret = clk_prepare_enable(priv->pclk);
- if (ret) {
- dev_err(dev, "core clock enable failed\n");
- return ret;
- }
-
- ret = devm_add_action_or_reset(dev,
- (void(*)(void *))clk_disable_unprepare,
- priv->pclk);
- if (ret)
- return ret;
-
ret = device_reset(dev);
if (ret) {
dev_err(dev, "reset failed\n");
--
2.43.0
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] ASoC: meson: aiu: fix function pointer type mismatch
2024-02-13 21:58 ` [PATCH v2 1/2] " Jerome Brunet
@ 2024-02-14 0:22 ` Justin Stitt
0 siblings, 0 replies; 6+ messages in thread
From: Justin Stitt @ 2024-02-14 0:22 UTC (permalink / raw)
To: Jerome Brunet
Cc: Mark Brown, Arnd Bergmann, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Neil Armstrong, Kevin Hilman, Martin Blumenstingl,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, alsa-devel,
linux-sound, linux-arm-kernel, linux-amlogic, linux-kernel, llvm
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] ASoC: meson: t9015: fix function pointer type mismatch
2024-02-13 21:58 ` [PATCH v2 2/2] ASoC: meson: t9015: " Jerome Brunet
@ 2024-02-14 0:27 ` Justin Stitt
0 siblings, 0 replies; 6+ messages in thread
From: Justin Stitt @ 2024-02-14 0:27 UTC (permalink / raw)
To: Jerome Brunet
Cc: Mark Brown, Arnd Bergmann, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Neil Armstrong, Kevin Hilman, Martin Blumenstingl,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, alsa-devel,
linux-sound, linux-arm-kernel, linux-amlogic, linux-kernel, llvm
Hi,
On Tue, Feb 13, 2024 at 10:58:04PM +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/t9015.c:274:4: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
> 274 | (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: 33901f5b9b16 ("ASoC: meson: add t9015 internal DAC driver")
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Justin Stitt <justinstitt@google.com>
> ---
> sound/soc/meson/t9015.c | 20 ++++----------------
> 1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/sound/soc/meson/t9015.c b/sound/soc/meson/t9015.c
> index 9c6b4dac6893..571f65788c59 100644
> --- a/sound/soc/meson/t9015.c
> +++ b/sound/soc/meson/t9015.c
> @@ -48,7 +48,6 @@
> #define POWER_CFG 0x10
>
> struct t9015 {
> - struct clk *pclk;
> struct regulator *avdd;
> };
>
> @@ -249,6 +248,7 @@ static int t9015_probe(struct platform_device *pdev)
> struct t9015 *priv;
> void __iomem *regs;
> struct regmap *regmap;
> + struct clk *pclk;
> int ret;
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> @@ -256,26 +256,14 @@ static int t9015_probe(struct platform_device *pdev)
> return -ENOMEM;
> platform_set_drvdata(pdev, priv);
>
> - priv->pclk = devm_clk_get(dev, "pclk");
> - if (IS_ERR(priv->pclk))
> - return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get core clock\n");
> + pclk = devm_clk_get_enabled(dev, "pclk");
> + if (IS_ERR(pclk))
> + return dev_err_probe(dev, PTR_ERR(pclk), "failed to get core clock\n");
>
> priv->avdd = devm_regulator_get(dev, "AVDD");
> if (IS_ERR(priv->avdd))
> return dev_err_probe(dev, PTR_ERR(priv->avdd), "failed to AVDD\n");
>
> - ret = clk_prepare_enable(priv->pclk);
> - if (ret) {
> - dev_err(dev, "core clock enable failed\n");
> - return ret;
> - }
> -
> - ret = devm_add_action_or_reset(dev,
> - (void(*)(void *))clk_disable_unprepare,
> - priv->pclk);
> - if (ret)
> - return ret;
> -
> ret = device_reset(dev);
> if (ret) {
> dev_err(dev, "reset failed\n");
> --
> 2.43.0
>
Thanks
Justin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] ASoC: meson: aiu: fix function pointer type mismatch
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-13 21:58 ` [PATCH v2 2/2] ASoC: meson: t9015: " Jerome Brunet
@ 2024-02-14 13:22 ` Mark Brown
2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2024-02-14 13:22 UTC (permalink / raw)
To: Jerome Brunet
Cc: Arnd Bergmann, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Neil Armstrong, Kevin Hilman, Martin Blumenstingl,
Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
alsa-devel, linux-sound, linux-arm-kernel, linux-amlogic,
linux-kernel, llvm
On Tue, 13 Feb 2024 22:58:02 +0100, Jerome Brunet wrote:
> This patchset fixes 2 -Wcast-function-type-strict warning in amlogic
> audio drivers with clang 16.
>
> Changes since v1: [0]
> * use devm_clk_get_enabled() instead of adding a dedicated helper in each
> driver.
> * Split the patch, 1 per fixed commit to make it easier for stable.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: meson: aiu: fix function pointer type mismatch
commit: 98ac85a00f31d2e9d5452b825a9ed0153d934043
[2/2] ASoC: meson: t9015: fix function pointer type mismatch
commit: 5ad992c71b6a8e8a547954addc7af9fbde6ca10a
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-02-14 13:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox