From 1a8bf351ccde7527ca0427151b5fe43f64fa1eac Mon Sep 17 00:00:00 2001 From: Krzysztof Wilczyński Date: Thu, 29 Jun 2023 16:59:54 +0000 Subject: PCI: meson: Remove cast between incompatible function type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/dwc/pci-meson.c:191:6: warning: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict] (void (*) (void *))clk_disable_unprepare, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ No functional changes are intended. Fixes: 9c0ef6d34fdb ("PCI: amlogic: Add the Amlogic Meson PCIe controller driver") Link: https://lore.kernel.org/linux-pci/20230629165956.237832-1-kwilczynski@kernel.org Reviewed-by: Neil Armstrong Signed-off-by: Krzysztof Wilczyński --- drivers/pci/controller/dwc/pci-meson.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c index c1527693bed9..34990a6363d0 100644 --- a/drivers/pci/controller/dwc/pci-meson.c +++ b/drivers/pci/controller/dwc/pci-meson.c @@ -163,6 +163,13 @@ static int meson_pcie_reset(struct meson_pcie *mp) return 0; } +static inline void meson_pcie_disable_clock(void *data) +{ + struct clk *clk = data; + + clk_disable_unprepare(clk); +} + static inline struct clk *meson_pcie_probe_clock(struct device *dev, const char *id, u64 rate) { @@ -187,9 +194,7 @@ static inline struct clk *meson_pcie_probe_clock(struct device *dev, return ERR_PTR(ret); } - devm_add_action_or_reset(dev, - (void (*) (void *))clk_disable_unprepare, - clk); + devm_add_action_or_reset(dev, meson_pcie_disable_clock, clk); return clk; } -- cgit v1.2.3 From 7a6531696668f1c9251f6b7219c02519f652be3d Mon Sep 17 00:00:00 2001 From: Krzysztof Wilczyński Date: Thu, 29 Jun 2023 16:59:55 +0000 Subject: PCI: keembay: Remove cast between incompatible function type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/dwc/pcie-keembay.c:172:12: warning: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict] (void(*)(void *))clk_disable_unprepare, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ No functional changes are intended. Fixes: 0c87f90b4c13 ("PCI: keembay: Add support for Intel Keem Bay") Link: https://lore.kernel.org/linux-pci/20230629165956.237832-2-kwilczynski@kernel.org Acked-by: Srikanth Thokala Signed-off-by: Krzysztof Wilczyński --- drivers/pci/controller/dwc/pcie-keembay.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/controller/dwc/pcie-keembay.c b/drivers/pci/controller/dwc/pcie-keembay.c index f90f36bac018..289bff99d762 100644 --- a/drivers/pci/controller/dwc/pcie-keembay.c +++ b/drivers/pci/controller/dwc/pcie-keembay.c @@ -148,6 +148,13 @@ static const struct dw_pcie_ops keembay_pcie_ops = { .stop_link = keembay_pcie_stop_link, }; +static inline void keembay_pcie_disable_clock(void *data) +{ + struct clk *clk = data; + + clk_disable_unprepare(clk); +} + static inline struct clk *keembay_pcie_probe_clock(struct device *dev, const char *id, u64 rate) { @@ -168,9 +175,7 @@ static inline struct clk *keembay_pcie_probe_clock(struct device *dev, if (ret) return ERR_PTR(ret); - ret = devm_add_action_or_reset(dev, - (void(*)(void *))clk_disable_unprepare, - clk); + ret = devm_add_action_or_reset(dev, keembay_pcie_disable_clock, clk); if (ret) return ERR_PTR(ret); -- cgit v1.2.3 From ed3cac7c5ac6e7f284100995b80a0a60770c990c Mon Sep 17 00:00:00 2001 From: Krzysztof Wilczyński Date: Thu, 29 Jun 2023 16:59:56 +0000 Subject: PCI: microchip: Remove cast between incompatible function type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: 6f15a9c9f941 ("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 Signed-off-by: Daire McNamara Co-developed-by: Simon Horman Signed-off-by: Simon Horman Signed-off-by: Krzysztof Wilczyński Acked-by: Conor Dooley --- drivers/pci/controller/pcie-microchip-host.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c index 5e710e485464..d30286f815e7 100644 --- a/drivers/pci/controller/pcie-microchip-host.c +++ b/drivers/pci/controller/pcie-microchip-host.c @@ -848,6 +848,13 @@ static const struct irq_domain_ops event_domain_ops = { .map = mc_pcie_event_map, }; +static inline void mc_pcie_deinit_clk(void *data) +{ + struct clk *clk = data; + + clk_disable_unprepare(clk); +} + static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id) { struct clk *clk; @@ -863,8 +870,7 @@ static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id) if (ret) return ERR_PTR(ret); - devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare, - clk); + devm_add_action_or_reset(dev, mc_pcie_deinit_clk, clk); return clk; } -- cgit v1.2.3