Skip to content

Commit 9b23fce

Browse files
arndbdavem330
authored andcommitted
ethernet: cpts: fix function pointer cast warnings
clang-16 warns about the mismatched prototypes for the devm_* callbacks: drivers/net/ethernet/ti/cpts.c:691:12: error: cast from 'void (*)(struct clk_hw *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 691 | (void(*)(void *))clk_hw_unregister_mux, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/device.h:406:34: note: expanded from macro 'devm_add_action_or_reset' 406 | __devm_add_action_or_reset(dev, action, data, #action) | ^~~~~~ drivers/net/ethernet/ti/cpts.c:703:12: error: cast from 'void (*)(struct device_node *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 703 | (void(*)(void *))of_clk_del_provider, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/device.h:406:34: note: expanded from macro 'devm_add_action_or_reset' 406 | __devm_add_action_or_reset(dev, action, data, #action) Use separate helper functions for this instead, using the expected prototypes with a void* argument. Fixes: a3047a8 ("net: ethernet: ti: cpts: add support for ext rftclk selection") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5d07e43 commit 9b23fce

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/net/ethernet/ti/cpts.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,16 @@ static void cpts_calc_mult_shift(struct cpts *cpts)
638638
freq, cpts->cc.mult, cpts->cc.shift, (ns - NSEC_PER_SEC));
639639
}
640640

641+
static void cpts_clk_unregister(void *clk)
642+
{
643+
clk_hw_unregister_mux(clk);
644+
}
645+
646+
static void cpts_clk_del_provider(void *np)
647+
{
648+
of_clk_del_provider(np);
649+
}
650+
641651
static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node)
642652
{
643653
struct device_node *refclk_np;
@@ -687,9 +697,7 @@ static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node)
687697
goto mux_fail;
688698
}
689699

690-
ret = devm_add_action_or_reset(cpts->dev,
691-
(void(*)(void *))clk_hw_unregister_mux,
692-
clk_hw);
700+
ret = devm_add_action_or_reset(cpts->dev, cpts_clk_unregister, clk_hw);
693701
if (ret) {
694702
dev_err(cpts->dev, "add clkmux unreg action %d", ret);
695703
goto mux_fail;
@@ -699,8 +707,7 @@ static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node)
699707
if (ret)
700708
goto mux_fail;
701709

702-
ret = devm_add_action_or_reset(cpts->dev,
703-
(void(*)(void *))of_clk_del_provider,
710+
ret = devm_add_action_or_reset(cpts->dev, cpts_clk_del_provider,
704711
refclk_np);
705712
if (ret) {
706713
dev_err(cpts->dev, "add clkmux provider unreg action %d", ret);

0 commit comments

Comments
 (0)