* [PATCH 1/3] PCI: meson: Remove cast between incompatible function type
@ 2023-06-29 16:59 Krzysztof Wilczyński
2023-06-29 16:59 ` [PATCH 2/3] PCI: keembay: " Krzysztof Wilczyński
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Krzysztof Wilczyński @ 2023-06-29 16:59 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Lorenzo Pieralisi, Rob Herring, Yue Wang, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Srikanth Thokala, Daire McNamara, Conor Dooley, linux-pci,
linux-arm-kernel, linux-amlogic, linux-riscv
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 <kwilczynski@kernel.org>
---
drivers/pci/controller/dwc/pci-meson.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
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;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] PCI: keembay: Remove cast between incompatible function type
2023-06-29 16:59 [PATCH 1/3] PCI: meson: Remove cast between incompatible function type Krzysztof Wilczyński
@ 2023-06-29 16:59 ` Krzysztof Wilczyński
2023-06-30 10:20 ` Thokala, Srikanth
2023-06-29 16:59 ` [PATCH 3/3] PCI: microchip: " Krzysztof Wilczyński
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Wilczyński @ 2023-06-29 16:59 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Lorenzo Pieralisi, Rob Herring, Yue Wang, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Srikanth Thokala, Daire McNamara, Conor Dooley, linux-pci,
linux-arm-kernel, linux-amlogic, linux-riscv
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")
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
---
drivers/pci/controller/dwc/pcie-keembay.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
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);
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] PCI: microchip: Remove cast between incompatible function type
2023-06-29 16:59 [PATCH 1/3] PCI: meson: Remove cast between incompatible function type Krzysztof Wilczyński
2023-06-29 16:59 ` [PATCH 2/3] PCI: keembay: " Krzysztof Wilczyński
@ 2023-06-29 16:59 ` Krzysztof Wilczyński
2023-06-29 20:30 ` Conor Dooley
2023-06-30 7:49 ` [PATCH 1/3] PCI: meson: " Neil Armstrong
2023-07-04 16:16 ` Krzysztof Wilczyński
3 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Wilczyński @ 2023-06-29 16:59 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Lorenzo Pieralisi, Rob Herring, Yue Wang, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Srikanth Thokala, Daire McNamara, Conor Dooley, linux-pci,
linux-arm-kernel, linux-amlogic, linux-riscv
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")
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>
---
drivers/pci/controller/pcie-microchip-host.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
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;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] PCI: microchip: Remove cast between incompatible function type
2023-06-29 16:59 ` [PATCH 3/3] PCI: microchip: " Krzysztof Wilczyński
@ 2023-06-29 20:30 ` Conor Dooley
2023-06-29 20:47 ` Krzysztof Wilczyński
0 siblings, 1 reply; 8+ messages in thread
From: Conor Dooley @ 2023-06-29 20:30 UTC (permalink / raw)
To: Krzysztof Wilczyński
Cc: Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, Yue Wang,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Srikanth Thokala, Daire McNamara, Conor Dooley, linux-pci,
linux-arm-kernel, linux-amlogic, linux-riscv
[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]
On Thu, Jun 29, 2023 at 04:59:56PM +0000, Krzysztof Wilczyński wrote:
> 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")
> 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>
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.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Cheers,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] PCI: microchip: Remove cast between incompatible function type
2023-06-29 20:30 ` Conor Dooley
@ 2023-06-29 20:47 ` Krzysztof Wilczyński
0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Wilczyński @ 2023-06-29 20:47 UTC (permalink / raw)
To: Conor Dooley
Cc: Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, Yue Wang,
Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Srikanth Thokala, Daire McNamara, Conor Dooley, linux-pci,
linux-arm-kernel, linux-amlogic, linux-riscv
Hello,
[...]
> > Fixes: 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controller driver")
> > 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>
>
> 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.
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
Thank you!
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] PCI: meson: Remove cast between incompatible function type
2023-06-29 16:59 [PATCH 1/3] PCI: meson: Remove cast between incompatible function type Krzysztof Wilczyński
2023-06-29 16:59 ` [PATCH 2/3] PCI: keembay: " Krzysztof Wilczyński
2023-06-29 16:59 ` [PATCH 3/3] PCI: microchip: " Krzysztof Wilczyński
@ 2023-06-30 7:49 ` Neil Armstrong
2023-07-04 16:16 ` Krzysztof Wilczyński
3 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2023-06-30 7:49 UTC (permalink / raw)
To: Krzysztof Wilczyński, Bjorn Helgaas
Cc: Lorenzo Pieralisi, Rob Herring, Yue Wang, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Srikanth Thokala,
Daire McNamara, Conor Dooley, linux-pci, linux-arm-kernel,
linux-amlogic, linux-riscv
On 29/06/2023 18:59, Krzysztof Wilczyński wrote:
> 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 <kwilczynski@kernel.org>
> ---
> drivers/pci/controller/dwc/pci-meson.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
<snip>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 2/3] PCI: keembay: Remove cast between incompatible function type
2023-06-29 16:59 ` [PATCH 2/3] PCI: keembay: " Krzysztof Wilczyński
@ 2023-06-30 10:20 ` Thokala, Srikanth
0 siblings, 0 replies; 8+ messages in thread
From: Thokala, Srikanth @ 2023-06-30 10:20 UTC (permalink / raw)
To: Krzysztof Wilczyński, Bjorn Helgaas
Cc: Lorenzo Pieralisi, Rob Herring, Yue Wang, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Daire McNamara,
Conor Dooley, linux-pci, linux-arm-kernel, linux-amlogic,
linux-riscv
> -----Original Message-----
> From: Krzysztof Wilczyński <kwilczynski@kernel.org>
> Sent: Thursday, June 29, 2023 10:30 PM
> To: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>; Rob Herring
> <robh@kernel.org>; Yue Wang <yue.wang@Amlogic.com>; Neil Armstrong
> <neil.armstrong@linaro.org>; Kevin Hilman <khilman@baylibre.com>; Jerome
> Brunet <jbrunet@baylibre.com>; Martin Blumenstingl
> <martin.blumenstingl@googlemail.com>; Thokala, Srikanth
> <srikanth.thokala@intel.com>; Daire McNamara
> <daire.mcnamara@microchip.com>; Conor Dooley <conor.dooley@microchip.com>;
> linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> amlogic@lists.infradead.org; linux-riscv@lists.infradead.org
> Subject: [PATCH 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.
>
> Fixes: 0c87f90b4c13 ("PCI: keembay: Add support for Intel Keem Bay")
> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
> ---
> drivers/pci/controller/dwc/pcie-keembay.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> 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);
Acked-by: Srikanth Thokala <srikanth.thokala@intel.com>
Thank you.
Srikanth
> if (ret)
> return ERR_PTR(ret);
>
> --
> 2.41.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] PCI: meson: Remove cast between incompatible function type
2023-06-29 16:59 [PATCH 1/3] PCI: meson: Remove cast between incompatible function type Krzysztof Wilczyński
` (2 preceding siblings ...)
2023-06-30 7:49 ` [PATCH 1/3] PCI: meson: " Neil Armstrong
@ 2023-07-04 16:16 ` Krzysztof Wilczyński
3 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Wilczyński @ 2023-07-04 16:16 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Lorenzo Pieralisi, Rob Herring, Yue Wang, Neil Armstrong,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Srikanth Thokala, Daire McNamara, Conor Dooley, linux-pci,
linux-arm-kernel, linux-amlogic, linux-riscv
Hello,
> 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.
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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-04 16:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 16:59 [PATCH 1/3] PCI: meson: Remove cast between incompatible function type Krzysztof Wilczyński
2023-06-29 16:59 ` [PATCH 2/3] PCI: keembay: " Krzysztof Wilczyński
2023-06-30 10:20 ` Thokala, Srikanth
2023-06-29 16:59 ` [PATCH 3/3] PCI: microchip: " Krzysztof Wilczyński
2023-06-29 20:30 ` Conor Dooley
2023-06-29 20:47 ` Krzysztof Wilczyński
2023-06-30 7:49 ` [PATCH 1/3] PCI: meson: " Neil Armstrong
2023-07-04 16:16 ` Krzysztof Wilczyński
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).