PCI: meson: Remove cast between incompatible function type
Subsystems (6)
Krzysztof Wilczyński
maintainerPATCH 1/3 PCI: meson: 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/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.
--- drivers/pci/controller/dwc/pci-meson.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pci-meson.c +8 -3
@@ -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; }
Signature · 1 line
2.41.0
Krzysztof Wilczyński
maintainerPATCH 2/3 PCI: keembay: 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/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.
--- drivers/pci/controller/dwc/pcie-keembay.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-keembay.c +8 -3
@@ -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);
Signature · 1 line
2.41.0
RE: [PATCH 2/3] PCI: keembay: Remove cast between incompatible function type
Quoted 61 lines
-----Original Message-----
From: Krzysztof Wilczyński <[email protected]>
Sent: Thursday, June 29, 2023 10:30 PM
To: Bjorn Helgaas <[email protected]>
Cc: Lorenzo Pieralisi <[email protected]>; Rob Herring <[email protected]>; Yue Wang <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Thokala, Srikanth <[email protected]>; Daire McNamara <[email protected]>; Conor Dooley <[email protected]>; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH 2/3] PCI: keembay: Remove cast between incompatible function typeRather 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")Signed-off-by Krzysztof Wilczyński <[email protected]>--- drivers/pci/controller/dwc/pcie-keembay.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/pci/controller/dwc/pcie-keembay.c +7
-0@@ -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) {
drivers/pci/controller/dwc/pcie-keembay.c static inline struct clk · line 180
Quoted 9 lines
drivers/pci/controller/dwc/pcie-keembay.c +1
-3@@ -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);
Thank you.
Srikanth
Quoted 5 lines
drivers/pci/controller/dwc/pcie-keembay.c +0
-0if (ret)return
ERR_PTR(ret);--
2.41.0
Krzysztof Wilczyński
maintainerPATCH 3/3 PCI: microchip: Remove cast between incompatible function type
In reply to Krzysztof WilczyńskiRather 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.
--- drivers/pci/controller/pcie-microchip-host.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pci/controller/pcie-microchip-host.c +8 -2
@@ -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; }
Signature · 1 line
2.41.0
Re: [PATCH 3/3] PCI: microchip: Remove cast between incompatible function type
Quoted 15 lines · Krzysztof Wilczyński
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.
Quoted 6 lines
Fixes 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controller driver")Co-developed-by Daire McNamara <[email protected]>Signed-off-by Daire McNamara <[email protected]>Co-developed-by Simon Horman <[email protected]>Signed-off-by Simon Horman <[email protected]>Signed-off-by Krzysztof Wilczyński <[email protected]>
This looks to be the same content wise as the patch I previously acked & effectively the same as the one I previously reviewed - you could have picked up either of those tags from the other submissions tbh.
Cheers,
Conor.
Krzysztof Wilczyński
maintainerRe: [PATCH 3/3] PCI: microchip: Remove cast between incompatible function type
Hello,
[...]
Quoted 10 lines
Quoted 6 lines
Fixes 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controller driver")Co-developed-by Daire McNamara <[email protected]>Signed-off-by Daire McNamara <[email protected]>Co-developed-by Simon Horman <[email protected]>Signed-off-by Simon Horman <[email protected]>Signed-off-by Krzysztof Wilczyński <[email protected]>This looks to be the same content wise as the patch I previously acked & effectively the same as the one I previously reviewed - you could have picked up either of those tags from the other submissions tbh.
I had thought about it but decided against it, as I wasn't sure if that would be OK, given a new series and new author, etc., even though the code is almost identical. I have seen you offered Reviewed-by and Acked-by once before, and I appreciate that.
Quoted 1 line
Acked-by Conor Dooley <[email protected]>
Thank you!
Krzysztof
Quoted 21 lines · Krzysztof Wilczyński
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")Signed-off-by Krzysztof Wilczyński <[email protected]>--- drivers/pci/controller/dwc/pci-meson.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
<snip>
Hello,
Quoted 8 lines
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.
Quoted 6 lines
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.
Applied to controller/remove-void-cast, thank you everyone!
[01/03] PCI: meson: Remove cast between incompatible function type
https://git.kernel.org/pci/pci/c/60fce60ab7b6 [02/03] PCI: keembay: Remove cast between incompatible function type https://git.kernel.org/pci/pci/c/43a2eef7cbba [03/03] PCI: microchip: Remove cast between incompatible function type https://git.kernel.org/pci/pci/c/9e4811ce626f Krzysztof