* [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop
@ 2026-01-02 12:50 Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 2/3] ata: ahci-imx: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:50 UTC (permalink / raw)
To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, linux-ide,
linux-kernel, imx, linux-arm-kernel, llvm
Cc: Krzysztof Kozlowski
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
drivers/ata/ahci_dwc.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/ahci_dwc.c b/drivers/ata/ahci_dwc.c
index aec6d793f51a..bfd24772ee67 100644
--- a/drivers/ata/ahci_dwc.c
+++ b/drivers/ata/ahci_dwc.c
@@ -260,7 +260,6 @@ static void ahci_dwc_init_timer(struct ahci_host_priv *hpriv)
static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
{
struct ahci_dwc_host_priv *dpriv = hpriv->plat_data;
- struct device_node *child;
void __iomem *port_mmio;
u32 port, dmacr, ts;
@@ -271,14 +270,12 @@ static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
* the HBA global reset so we can freely initialize it once until the
* next system reset.
*/
- for_each_child_of_node(dpriv->pdev->dev.of_node, child) {
+ for_each_child_of_node_scoped(dpriv->pdev->dev.of_node, child) {
if (!of_device_is_available(child))
continue;
- if (of_property_read_u32(child, "reg", &port)) {
- of_node_put(child);
+ if (of_property_read_u32(child, "reg", &port))
return -EINVAL;
- }
port_mmio = __ahci_port_base(hpriv, port);
dmacr = readl(port_mmio + AHCI_DWC_PORT_DMACR);
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] ata: ahci-imx: Fix Wvoid-pointer-to-enum-cast warning
2026-01-02 12:50 [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2026-01-02 12:50 ` Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 3/3] ata: ahci-xgene: " Krzysztof Kozlowski
2026-01-05 10:52 ` [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Jonathan Cameron
2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:50 UTC (permalink / raw)
To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, linux-ide,
linux-kernel, imx, linux-arm-kernel, llvm
Cc: Krzysztof Kozlowski
"imxpriv->type" is an enum, thus cast of pointer on 64-bit compile test
with clang W=1 causes:
ahci_imx.c:872:18: error: cast to smaller integer type 'enum ahci_imx_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
drivers/ata/ahci_imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 86aedd5923ac..3d26595524d3 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -869,7 +869,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
imxpriv->ahci_pdev = pdev;
imxpriv->no_device = false;
imxpriv->first_time = true;
- imxpriv->type = (enum ahci_imx_type)device_get_match_data(dev);
+ imxpriv->type = (unsigned long)device_get_match_data(dev);
imxpriv->sata_clk = devm_clk_get(dev, "sata");
if (IS_ERR(imxpriv->sata_clk)) {
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] ata: ahci-xgene: Fix Wvoid-pointer-to-enum-cast warning
2026-01-02 12:50 [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 2/3] ata: ahci-imx: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
@ 2026-01-02 12:50 ` Krzysztof Kozlowski
2026-01-05 10:52 ` [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Jonathan Cameron
2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:50 UTC (permalink / raw)
To: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, linux-ide,
linux-kernel, imx, linux-arm-kernel, llvm
Cc: Krzysztof Kozlowski
"version" is an enum, thus cast of pointer on 64-bit compile test with
clang W=1 causes:
ahci_xgene.c:776:13: error: cast to smaller integer type 'enum xgene_ahci_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
drivers/ata/ahci_xgene.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 6b8844646fcd..98c99b5a8242 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -773,7 +773,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
}
if (dev->of_node) {
- version = (enum xgene_ahci_version)of_device_get_match_data(dev);
+ version = (unsigned long)of_device_get_match_data(dev);
}
#ifdef CONFIG_ACPI
else {
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop
2026-01-02 12:50 [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 2/3] ata: ahci-imx: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 3/3] ata: ahci-xgene: " Krzysztof Kozlowski
@ 2026-01-05 10:52 ` Jonathan Cameron
2026-01-05 13:05 ` Krzysztof Kozlowski
2 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2026-01-05 10:52 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, linux-ide,
linux-kernel, imx, linux-arm-kernel, llvm
On Fri, 2 Jan 2026 13:50:41 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
A whilst you are here suggestion inline to make it a bit simpler.
> ---
> drivers/ata/ahci_dwc.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/ata/ahci_dwc.c b/drivers/ata/ahci_dwc.c
> index aec6d793f51a..bfd24772ee67 100644
> --- a/drivers/ata/ahci_dwc.c
> +++ b/drivers/ata/ahci_dwc.c
> @@ -260,7 +260,6 @@ static void ahci_dwc_init_timer(struct ahci_host_priv *hpriv)
> static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
> {
> struct ahci_dwc_host_priv *dpriv = hpriv->plat_data;
> - struct device_node *child;
> void __iomem *port_mmio;
> u32 port, dmacr, ts;
>
> @@ -271,14 +270,12 @@ static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
> * the HBA global reset so we can freely initialize it once until the
> * next system reset.
> */
> - for_each_child_of_node(dpriv->pdev->dev.of_node, child) {
> + for_each_child_of_node_scoped(dpriv->pdev->dev.of_node, child) {
> if (!of_device_is_available(child))
for_each_available_child_of_node_scoped()?
> continue;
>
> - if (of_property_read_u32(child, "reg", &port)) {
> - of_node_put(child);
> + if (of_property_read_u32(child, "reg", &port))
> return -EINVAL;
> - }
>
> port_mmio = __ahci_port_base(hpriv, port);
> dmacr = readl(port_mmio + AHCI_DWC_PORT_DMACR);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop
2026-01-05 10:52 ` [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Jonathan Cameron
@ 2026-01-05 13:05 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-05 13:05 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Damien Le Moal, Niklas Cassel, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, linux-ide,
linux-kernel, imx, linux-arm-kernel, llvm
On 05/01/2026 11:52, Jonathan Cameron wrote:
> On Fri, 2 Jan 2026 13:50:41 +0100
> Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> wrote:
>
>> Use scoped for-each loop when iterating over device nodes to make code a
>> bit simpler.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
>
> A whilst you are here suggestion inline to make it a bit simpler.
>
>> ---
>> drivers/ata/ahci_dwc.c | 7 ++-----
>> 1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/ata/ahci_dwc.c b/drivers/ata/ahci_dwc.c
>> index aec6d793f51a..bfd24772ee67 100644
>> --- a/drivers/ata/ahci_dwc.c
>> +++ b/drivers/ata/ahci_dwc.c
>> @@ -260,7 +260,6 @@ static void ahci_dwc_init_timer(struct ahci_host_priv *hpriv)
>> static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
>> {
>> struct ahci_dwc_host_priv *dpriv = hpriv->plat_data;
>> - struct device_node *child;
>> void __iomem *port_mmio;
>> u32 port, dmacr, ts;
>>
>> @@ -271,14 +270,12 @@ static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
>> * the HBA global reset so we can freely initialize it once until the
>> * next system reset.
>> */
>> - for_each_child_of_node(dpriv->pdev->dev.of_node, child) {
>> + for_each_child_of_node_scoped(dpriv->pdev->dev.of_node, child) {
>> if (!of_device_is_available(child))
>
> for_each_available_child_of_node_scoped()?
Huh, indeed I did not notice it. Thanks!
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-05 13:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 12:50 [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 2/3] ata: ahci-imx: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
2026-01-02 12:50 ` [PATCH 3/3] ata: ahci-xgene: " Krzysztof Kozlowski
2026-01-05 10:52 ` [PATCH 1/3] ata: ahci-dwc: Simplify with scoped for each OF child loop Jonathan Cameron
2026-01-05 13:05 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox