* [PATCH 1/4] mmc: atmel-mci: Simplify with scoped for each OF child loop
@ 2025-12-24 12:44 Krzysztof Kozlowski
2025-12-24 12:44 ` [PATCH 2/4] mmc: cavium-octeon: " Krzysztof Kozlowski
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 12:44 UTC (permalink / raw)
To: Aubin Constans, Ulf Hansson, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Robert Richter, Paul Cercueil, Andrew Jeffery,
Adrian Hunter, Joel Stanley, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt, linux-mmc, linux-arm-kernel,
linux-kernel, linux-mips, linux-aspeed, openbmc, 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/mmc/host/atmel-mci.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index fdf6926ea468..3b4928f5b9b2 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -629,14 +629,13 @@ static int atmci_of_init(struct atmel_mci *host)
{
struct device *dev = host->dev;
struct device_node *np = dev->of_node;
- struct device_node *cnp;
u32 slot_id;
int err;
if (!np)
return dev_err_probe(dev, -EINVAL, "device node not found\n");
- for_each_child_of_node(np, cnp) {
+ for_each_child_of_node_scoped(np, cnp) {
if (of_property_read_u32(cnp, "reg", &slot_id)) {
dev_warn(dev, "reg property is missing for %pOF\n", cnp);
continue;
@@ -645,7 +644,6 @@ static int atmci_of_init(struct atmel_mci *host)
if (slot_id >= ATMCI_MAX_NR_SLOTS) {
dev_warn(dev, "can't have more than %d slots\n",
ATMCI_MAX_NR_SLOTS);
- of_node_put(cnp);
break;
}
@@ -658,10 +656,8 @@ static int atmci_of_init(struct atmel_mci *host)
"cd", GPIOD_IN, "cd-gpios");
err = PTR_ERR_OR_ZERO(host->pdata[slot_id].detect_pin);
if (err) {
- if (err != -ENOENT) {
- of_node_put(cnp);
+ if (err != -ENOENT)
return err;
- }
host->pdata[slot_id].detect_pin = NULL;
}
@@ -673,10 +669,8 @@ static int atmci_of_init(struct atmel_mci *host)
"wp", GPIOD_IN, "wp-gpios");
err = PTR_ERR_OR_ZERO(host->pdata[slot_id].wp_pin);
if (err) {
- if (err != -ENOENT) {
- of_node_put(cnp);
+ if (err != -ENOENT)
return err;
- }
host->pdata[slot_id].wp_pin = NULL;
}
}
--
2.51.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/4] mmc: cavium-octeon: Simplify with scoped for each OF child loop
2025-12-24 12:44 [PATCH 1/4] mmc: atmel-mci: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2025-12-24 12:44 ` Krzysztof Kozlowski
2025-12-24 12:44 ` [PATCH 3/4] mmc: jz4740: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 12:44 UTC (permalink / raw)
To: Aubin Constans, Ulf Hansson, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Robert Richter, Paul Cercueil, Andrew Jeffery,
Adrian Hunter, Joel Stanley, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt, linux-mmc, linux-arm-kernel,
linux-kernel, linux-mips, linux-aspeed, openbmc, 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/mmc/host/cavium-octeon.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-octeon.c
index 0592f356b1e5..8a0daddd9200 100644
--- a/drivers/mmc/host/cavium-octeon.c
+++ b/drivers/mmc/host/cavium-octeon.c
@@ -148,7 +148,7 @@ static void octeon_mmc_dmar_fixup_done(struct cvm_mmc_host *host)
static int octeon_mmc_probe(struct platform_device *pdev)
{
- struct device_node *cn, *node = pdev->dev.of_node;
+ struct device_node *node = pdev->dev.of_node;
struct cvm_mmc_host *host;
void __iomem *base;
int mmc_irq[9];
@@ -268,7 +268,7 @@ static int octeon_mmc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, host);
i = 0;
- for_each_child_of_node(node, cn) {
+ for_each_child_of_node_scoped(node, cn) {
host->slot_pdev[i] =
of_platform_device_create(cn, NULL, &pdev->dev);
if (!host->slot_pdev[i]) {
@@ -279,7 +279,6 @@ static int octeon_mmc_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev, "Error populating slots\n");
octeon_mmc_set_shared_power(host, 0);
- of_node_put(cn);
goto error;
}
i++;
--
2.51.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/4] mmc: jz4740: Fix Wvoid-pointer-to-enum-cast warning
2025-12-24 12:44 [PATCH 1/4] mmc: atmel-mci: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-24 12:44 ` [PATCH 2/4] mmc: cavium-octeon: " Krzysztof Kozlowski
@ 2025-12-24 12:44 ` Krzysztof Kozlowski
2025-12-24 13:30 ` Paul Cercueil
2025-12-24 12:44 ` [PATCH 4/4] mmc: sdhci: aspeed: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-24 16:29 ` [PATCH 1/4] mmc: atmel-mci: " Nicolas Ferre
3 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 12:44 UTC (permalink / raw)
To: Aubin Constans, Ulf Hansson, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Robert Richter, Paul Cercueil, Andrew Jeffery,
Adrian Hunter, Joel Stanley, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt, linux-mmc, linux-arm-kernel,
linux-kernel, linux-mips, linux-aspeed, openbmc, llvm
Cc: Krzysztof Kozlowski
"jz4740" is an enum, thus cast of pointer on 64-bit compile test with
clang W=1 causes:
jz4740_mmc.c:1055:18: error: cast to smaller integer type 'enum jz4740_mmc_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
drivers/mmc/host/jz4740_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index 6a0d0250d47b..6a3c26b7c82d 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -1052,7 +1052,7 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
host = mmc_priv(mmc);
/* Default if no match is JZ4740 */
- host->version = (enum jz4740_mmc_version)device_get_match_data(&pdev->dev);
+ host->version = (unsigned long)device_get_match_data(&pdev->dev);
ret = mmc_of_parse(mmc);
if (ret)
--
2.51.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/4] mmc: sdhci: aspeed: Simplify with scoped for each OF child loop
2025-12-24 12:44 [PATCH 1/4] mmc: atmel-mci: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-24 12:44 ` [PATCH 2/4] mmc: cavium-octeon: " Krzysztof Kozlowski
2025-12-24 12:44 ` [PATCH 3/4] mmc: jz4740: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
@ 2025-12-24 12:44 ` Krzysztof Kozlowski
2025-12-30 15:33 ` Ulf Hansson
2025-12-24 16:29 ` [PATCH 1/4] mmc: atmel-mci: " Nicolas Ferre
3 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 12:44 UTC (permalink / raw)
To: Aubin Constans, Ulf Hansson, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, Robert Richter, Paul Cercueil, Andrew Jeffery,
Adrian Hunter, Joel Stanley, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt, linux-mmc, linux-arm-kernel,
linux-kernel, linux-mips, linux-aspeed, openbmc, 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/mmc/host/sdhci-of-aspeed.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index ca97b01996b1..4296def69436 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -519,7 +519,7 @@ static struct platform_driver aspeed_sdhci_driver = {
static int aspeed_sdc_probe(struct platform_device *pdev)
{
- struct device_node *parent, *child;
+ struct device_node *parent;
struct aspeed_sdc *sdc;
int ret;
@@ -548,12 +548,11 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, sdc);
parent = pdev->dev.of_node;
- for_each_available_child_of_node(parent, child) {
+ for_each_available_child_of_node_scoped(parent, child) {
struct platform_device *cpdev;
cpdev = of_platform_device_create(child, NULL, &pdev->dev);
if (!cpdev) {
- of_node_put(child);
ret = -ENODEV;
goto err_clk;
}
--
2.51.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] mmc: jz4740: Fix Wvoid-pointer-to-enum-cast warning
2025-12-24 12:44 ` [PATCH 3/4] mmc: jz4740: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
@ 2025-12-24 13:30 ` Paul Cercueil
0 siblings, 0 replies; 7+ messages in thread
From: Paul Cercueil @ 2025-12-24 13:30 UTC (permalink / raw)
To: Krzysztof Kozlowski, Aubin Constans, Ulf Hansson, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, Robert Richter,
Andrew Jeffery, Adrian Hunter, Joel Stanley, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mmc,
linux-arm-kernel, linux-kernel, linux-mips, linux-aspeed,
openbmc, llvm
Hi Krzysztof,
Le mercredi 24 décembre 2025 à 13:44 +0100, Krzysztof Kozlowski a
écrit :
> "jz4740" is an enum, thus cast of pointer on 64-bit compile test with
> clang W=1 causes:
>
> jz4740_mmc.c:1055:18: error: cast to smaller integer type 'enum
> jz4740_mmc_version' from 'const void *' [-Werror,-Wvoid-pointer-to-
> enum-cast]
>
> Signed-off-by: Krzysztof Kozlowski
> <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Cheers,
-Paul
> ---
> drivers/mmc/host/jz4740_mmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/jz4740_mmc.c
> b/drivers/mmc/host/jz4740_mmc.c
> index 6a0d0250d47b..6a3c26b7c82d 100644
> --- a/drivers/mmc/host/jz4740_mmc.c
> +++ b/drivers/mmc/host/jz4740_mmc.c
> @@ -1052,7 +1052,7 @@ static int jz4740_mmc_probe(struct
> platform_device* pdev)
> host = mmc_priv(mmc);
>
> /* Default if no match is JZ4740 */
> - host->version = (enum
> jz4740_mmc_version)device_get_match_data(&pdev->dev);
> + host->version = (unsigned long)device_get_match_data(&pdev-
> >dev);
>
> ret = mmc_of_parse(mmc);
> if (ret)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] mmc: atmel-mci: Simplify with scoped for each OF child loop
2025-12-24 12:44 [PATCH 1/4] mmc: atmel-mci: Simplify with scoped for each OF child loop Krzysztof Kozlowski
` (2 preceding siblings ...)
2025-12-24 12:44 ` [PATCH 4/4] mmc: sdhci: aspeed: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2025-12-24 16:29 ` Nicolas Ferre
3 siblings, 0 replies; 7+ messages in thread
From: Nicolas Ferre @ 2025-12-24 16:29 UTC (permalink / raw)
To: Krzysztof Kozlowski, Aubin Constans, Ulf Hansson,
Alexandre Belloni, Claudiu Beznea, Robert Richter, Paul Cercueil,
Andrew Jeffery, Adrian Hunter, Joel Stanley, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mmc,
linux-arm-kernel, linux-kernel, linux-mips, linux-aspeed,
openbmc, llvm
On 24/12/2025 at 13:44, Krzysztof Kozlowski 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>
Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Thanks Krzysztof, best regards,
Nicolas
> ---
> drivers/mmc/host/atmel-mci.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index fdf6926ea468..3b4928f5b9b2 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -629,14 +629,13 @@ static int atmci_of_init(struct atmel_mci *host)
> {
> struct device *dev = host->dev;
> struct device_node *np = dev->of_node;
> - struct device_node *cnp;
> u32 slot_id;
> int err;
>
> if (!np)
> return dev_err_probe(dev, -EINVAL, "device node not found\n");
>
> - for_each_child_of_node(np, cnp) {
> + for_each_child_of_node_scoped(np, cnp) {
> if (of_property_read_u32(cnp, "reg", &slot_id)) {
> dev_warn(dev, "reg property is missing for %pOF\n", cnp);
> continue;
> @@ -645,7 +644,6 @@ static int atmci_of_init(struct atmel_mci *host)
> if (slot_id >= ATMCI_MAX_NR_SLOTS) {
> dev_warn(dev, "can't have more than %d slots\n",
> ATMCI_MAX_NR_SLOTS);
> - of_node_put(cnp);
> break;
> }
>
> @@ -658,10 +656,8 @@ static int atmci_of_init(struct atmel_mci *host)
> "cd", GPIOD_IN, "cd-gpios");
> err = PTR_ERR_OR_ZERO(host->pdata[slot_id].detect_pin);
> if (err) {
> - if (err != -ENOENT) {
> - of_node_put(cnp);
> + if (err != -ENOENT)
> return err;
> - }
> host->pdata[slot_id].detect_pin = NULL;
> }
>
> @@ -673,10 +669,8 @@ static int atmci_of_init(struct atmel_mci *host)
> "wp", GPIOD_IN, "wp-gpios");
> err = PTR_ERR_OR_ZERO(host->pdata[slot_id].wp_pin);
> if (err) {
> - if (err != -ENOENT) {
> - of_node_put(cnp);
> + if (err != -ENOENT)
> return err;
> - }
> host->pdata[slot_id].wp_pin = NULL;
> }
> }
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] mmc: sdhci: aspeed: Simplify with scoped for each OF child loop
2025-12-24 12:44 ` [PATCH 4/4] mmc: sdhci: aspeed: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2025-12-30 15:33 ` Ulf Hansson
0 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2025-12-30 15:33 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Aubin Constans, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
Robert Richter, Paul Cercueil, Andrew Jeffery, Adrian Hunter,
Joel Stanley, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
Justin Stitt, linux-mmc, linux-arm-kernel, linux-kernel,
linux-mips, linux-aspeed, openbmc, llvm
On Wed, 24 Dec 2025 at 13:44, 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>
All patches in the series applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-of-aspeed.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index ca97b01996b1..4296def69436 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -519,7 +519,7 @@ static struct platform_driver aspeed_sdhci_driver = {
> static int aspeed_sdc_probe(struct platform_device *pdev)
>
> {
> - struct device_node *parent, *child;
> + struct device_node *parent;
> struct aspeed_sdc *sdc;
> int ret;
>
> @@ -548,12 +548,11 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
> dev_set_drvdata(&pdev->dev, sdc);
>
> parent = pdev->dev.of_node;
> - for_each_available_child_of_node(parent, child) {
> + for_each_available_child_of_node_scoped(parent, child) {
> struct platform_device *cpdev;
>
> cpdev = of_platform_device_create(child, NULL, &pdev->dev);
> if (!cpdev) {
> - of_node_put(child);
> ret = -ENODEV;
> goto err_clk;
> }
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-12-30 15:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-24 12:44 [PATCH 1/4] mmc: atmel-mci: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-24 12:44 ` [PATCH 2/4] mmc: cavium-octeon: " Krzysztof Kozlowski
2025-12-24 12:44 ` [PATCH 3/4] mmc: jz4740: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
2025-12-24 13:30 ` Paul Cercueil
2025-12-24 12:44 ` [PATCH 4/4] mmc: sdhci: aspeed: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-30 15:33 ` Ulf Hansson
2025-12-24 16:29 ` [PATCH 1/4] mmc: atmel-mci: " Nicolas Ferre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®