Skip to content

Commit 5ad992c

Browse files
jbrun3tbroonie
authored andcommitted
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: 33901f5 ("ASoC: meson: add t9015 internal DAC driver") Reported-by: Arnd Bergmann <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Reviewed-by: Justin Stitt <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 98ac85a commit 5ad992c

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

sound/soc/meson/t9015.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#define POWER_CFG 0x10
4949

5050
struct t9015 {
51-
struct clk *pclk;
5251
struct regulator *avdd;
5352
};
5453

@@ -249,33 +248,22 @@ static int t9015_probe(struct platform_device *pdev)
249248
struct t9015 *priv;
250249
void __iomem *regs;
251250
struct regmap *regmap;
251+
struct clk *pclk;
252252
int ret;
253253

254254
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
255255
if (!priv)
256256
return -ENOMEM;
257257
platform_set_drvdata(pdev, priv);
258258

259-
priv->pclk = devm_clk_get(dev, "pclk");
260-
if (IS_ERR(priv->pclk))
261-
return dev_err_probe(dev, PTR_ERR(priv->pclk), "failed to get core clock\n");
259+
pclk = devm_clk_get_enabled(dev, "pclk");
260+
if (IS_ERR(pclk))
261+
return dev_err_probe(dev, PTR_ERR(pclk), "failed to get core clock\n");
262262

263263
priv->avdd = devm_regulator_get(dev, "AVDD");
264264
if (IS_ERR(priv->avdd))
265265
return dev_err_probe(dev, PTR_ERR(priv->avdd), "failed to AVDD\n");
266266

267-
ret = clk_prepare_enable(priv->pclk);
268-
if (ret) {
269-
dev_err(dev, "core clock enable failed\n");
270-
return ret;
271-
}
272-
273-
ret = devm_add_action_or_reset(dev,
274-
(void(*)(void *))clk_disable_unprepare,
275-
priv->pclk);
276-
if (ret)
277-
return ret;
278-
279267
ret = device_reset(dev);
280268
if (ret) {
281269
dev_err(dev, "reset failed\n");

0 commit comments

Comments
 (0)