Commit 5ad992c7 authored by Jerome Brunet's avatar Jerome Brunet Committed by Mark Brown

ASoC: meson: t9015: fix function pointer type mismatch

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: 33901f5b ("ASoC: meson: add t9015 internal DAC driver")
Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Reviewed-by: default avatarJustin Stitt <justinstitt@google.com>
Link: https://msgid.link/r/20240213215807.3326688-3-jbrunet@baylibre.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 98ac85a0
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#define POWER_CFG 0x10 #define POWER_CFG 0x10
struct t9015 { struct t9015 {
struct clk *pclk;
struct regulator *avdd; struct regulator *avdd;
}; };
...@@ -249,6 +248,7 @@ static int t9015_probe(struct platform_device *pdev) ...@@ -249,6 +248,7 @@ static int t9015_probe(struct platform_device *pdev)
struct t9015 *priv; struct t9015 *priv;
void __iomem *regs; void __iomem *regs;
struct regmap *regmap; struct regmap *regmap;
struct clk *pclk;
int ret; int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
...@@ -256,26 +256,14 @@ static int t9015_probe(struct platform_device *pdev) ...@@ -256,26 +256,14 @@ static int t9015_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
priv->pclk = devm_clk_get(dev, "pclk"); pclk = devm_clk_get_enabled(dev, "pclk");
if (IS_ERR(priv->pclk)) if (IS_ERR(pclk))
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get core clock\n"); return dev_err_probe(dev, PTR_ERR(pclk), "failed to get core clock\n");
priv->avdd = devm_regulator_get(dev, "AVDD"); priv->avdd = devm_regulator_get(dev, "AVDD");
if (IS_ERR(priv->avdd)) if (IS_ERR(priv->avdd))
return dev_err_probe(dev, PTR_ERR(priv->avdd), "failed to AVDD\n"); 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); ret = device_reset(dev);
if (ret) { if (ret) {
dev_err(dev, "reset failed\n"); dev_err(dev, "reset failed\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment