]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: meson: aiu: fix function pointer type mismatch
authorJerome Brunet <jbrunet@baylibre.com>
Tue, 13 Feb 2024 21:58:03 +0000 (22:58 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:21:57 +0000 (18:21 -0400)
[ Upstream commit 98ac85a00f31d2e9d5452b825a9ed0153d934043 ]

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>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Link: https://msgid.link/r/20240213215807.3326688-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/meson/aiu.c
sound/soc/meson/aiu.h

index 386a31a044700a2634a5dd722a041afc975a05ff..03bc3e5b6cab5799d11434ab048cb79487ab155d 100644 (file)
@@ -215,11 +215,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))
@@ -236,18 +237,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;
 }
 
index 87aa19ac4af3aff0267519db2ba86d4245db9455..44f8c213d35a0716701d82262c2a72cc536a09ea 100644 (file)
@@ -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;