ethernet: cpts: fix function pointer cast warnings
Subsystems (2)
PATCH 1/1 ethernet: cpts: fix function pointer cast warnings
From: Arnd Bergmann <[email protected]>
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.
--- drivers/net/ethernet/ti/cpts.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/net/ethernet/ti/cpts.c +12 -5
@@ -638,6 +638,16 @@ static void cpts_calc_mult_shift(struct cpts *cpts) freq, cpts->cc.mult, cpts->cc.shift, (ns - NSEC_PER_SEC)); } +static void cpts_clk_unregister (void *clk) +{ +clk_hw_unregister_mux (clk); +} + +static void cpts_clk_del_provider (void *np) +{ +of_clk_del_provider (np); +} +static int cpts_of_mux_clk_setup (struct cpts *cpts,struct device_node *node) {struct device_node *refclk_np;
@@ -687,9 +697,7 @@ static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node) goto mux_fail; } - ret =devm_add_action_or_reset (cpts->dev, - (void (*)(void *))clk_hw_unregister_mux, - clk_hw); + ret =devm_add_action_or_reset (cpts->dev, cpts_clk_unregister, clk_hw);if (ret) {dev_err (cpts->dev,"add clkmux unreg action %d" , ret); goto mux_fail;
@@ -699,8 +707,7 @@ static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node)if (ret) goto mux_fail; - ret =devm_add_action_or_reset (cpts->dev, - (void (*)(void *))of_clk_del_provider, + ret =devm_add_action_or_reset (cpts->dev, cpts_clk_del_provider, refclk_np);if (ret) {dev_err (cpts->dev,"add clkmux provider unreg action %d" , ret);
Signature · 1 line
2.39.2
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 11 lines · On Tue, 13 Feb 2024 11:16:34 +0100 you wrote:
From: Arnd Bergmann <[email protected]>
clang-16 warns about the mismatched prototypes for the devm_* callbacks:
drivers/net/ethernet/ti/cpts.c:691:12: error: cast from 'void (*)(structclk_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 (*)(structdevice_node*)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
Quoted 6 lines
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)[...]
Here is the summary with links:
- ethernet: cpts: fix function pointer cast warnings
https://git.kernel.org/netdev/net/c/9b23fceb4158
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html