Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: a3047a81ba13 ("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>

authored by

Arnd Bergmann and committed by
David S. Miller
9b23fceb 5d07e432

+12 -5
+12 -5
drivers/net/ethernet/ti/cpts.c
··· 638 638 freq, cpts->cc.mult, cpts->cc.shift, (ns - NSEC_PER_SEC)); 639 639 } 640 640 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 + 641 651 static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node) 642 652 { 643 653 struct device_node *refclk_np; ··· 697 687 goto mux_fail; 698 688 } 699 689 700 - ret = devm_add_action_or_reset(cpts->dev, 701 - (void(*)(void *))clk_hw_unregister_mux, 702 - clk_hw); 690 + ret = devm_add_action_or_reset(cpts->dev, cpts_clk_unregister, clk_hw); 703 691 if (ret) { 704 692 dev_err(cpts->dev, "add clkmux unreg action %d", ret); 705 693 goto mux_fail; ··· 707 699 if (ret) 708 700 goto mux_fail; 709 701 710 - ret = devm_add_action_or_reset(cpts->dev, 711 - (void(*)(void *))of_clk_del_provider, 702 + ret = devm_add_action_or_reset(cpts->dev, cpts_clk_del_provider, 712 703 refclk_np); 713 704 if (ret) { 714 705 dev_err(cpts->dev, "add clkmux provider unreg action %d", ret);