Skip to content

Commit ed3cac7

Browse files
committed
PCI: microchip: Remove cast between incompatible function type
Rather than casting void(*)(struct clk *) to void (*)(void *), that forces conversion to an incompatible function type, replace the cast with a small local stub function with a signature that matches what the devm_add_action_or_reset() function expects. The sub function takes a void *, then passes it directly to clk_disable_unprepare(), which handles the more specific type. Reported by clang when building with warnings enabled: drivers/pci/controller/pcie-microchip-host.c:866:32: warning: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict] devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ No functional changes are intended. Fixes: 6f15a9c ("PCI: microchip: Add Microchip PolarFire PCIe controller driver") Link: https://lore.kernel.org/linux-pci/20230629165956.237832-3-kwilczynski@kernel.org Link: https://lore.kernel.org/linux-pci/20230511-pci-microchip-clk-cast-v1-1-7674f4d4e218@kernel.org Link: https://lore.kernel.org/linux-pci/20230111125323.1911373-3-daire.mcnamara@microchip.com Co-developed-by: Daire McNamara <daire.mcnamara@microchip.com> Signed-off-by: Daire McNamara <daire.mcnamara@microchip.com> Co-developed-by: Simon Horman <horms@kernel.org> Signed-off-by: Simon Horman <horms@kernel.org> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Acked-by: Conor Dooley <conor.dooley@microchip.com>
1 parent 7a65316 commit ed3cac7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/pci/controller/pcie-microchip-host.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,13 @@ static const struct irq_domain_ops event_domain_ops = {
848848
.map = mc_pcie_event_map,
849849
};
850850

851+
static inline void mc_pcie_deinit_clk(void *data)
852+
{
853+
struct clk *clk = data;
854+
855+
clk_disable_unprepare(clk);
856+
}
857+
851858
static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
852859
{
853860
struct clk *clk;
@@ -863,8 +870,7 @@ static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
863870
if (ret)
864871
return ERR_PTR(ret);
865872

866-
devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
867-
clk);
873+
devm_add_action_or_reset(dev, mc_pcie_deinit_clk, clk);
868874

869875
return clk;
870876
}

0 commit comments

Comments
 (0)