linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] mtd: rawnand: brcm: Simplify with scoped for each OF child loop
@ 2026-01-02 12:49 Krzysztof Kozlowski
  2026-01-02 12:49 ` [PATCH 2/7] mtd: rawnand: denali: " Krzysztof Kozlowski
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:49 UTC (permalink / raw)
  To: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, 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/mtd/nand/raw/brcmnand/brcmnand.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 835653bdd5ab..0427d76f45d0 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -3298,7 +3298,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
 {
 	struct brcmnand_platform_data *pd = dev_get_platdata(&pdev->dev);
 	struct device *dev = &pdev->dev;
-	struct device_node *dn = dev->of_node, *child;
+	struct device_node *dn = dev->of_node;
 	struct brcmnand_controller *ctrl;
 	struct brcmnand_host *host;
 	struct resource *res;
@@ -3486,12 +3486,11 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
 		}
 	}
 
-	for_each_available_child_of_node(dn, child) {
+	for_each_available_child_of_node_scoped(dn, child) {
 		if (of_device_is_compatible(child, "brcm,nandcs")) {
 
 			host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
 			if (!host) {
-				of_node_put(child);
 				ret = -ENOMEM;
 				goto err;
 			}
@@ -3509,10 +3508,9 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
 
 			ret = brcmnand_init_cs(host, NULL);
 			if (ret) {
-				if (ret == -EPROBE_DEFER) {
-					of_node_put(child);
+				if (ret == -EPROBE_DEFER)
 					goto err;
-				}
+
 				devm_kfree(dev, host);
 				continue; /* Try all chip-selects */
 			}
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/7] mtd: rawnand: denali: Simplify with scoped for each OF child loop
  2026-01-02 12:49 [PATCH 1/7] mtd: rawnand: brcm: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2026-01-02 12:49 ` Krzysztof Kozlowski
  2026-01-02 12:49 ` [PATCH 3/7] mtd: rawnand: ingenic: " Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:49 UTC (permalink / raw)
  To: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, 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/mtd/nand/raw/denali_dt.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
index e0dd59bba4bd..8c822eae72e7 100644
--- a/drivers/mtd/nand/raw/denali_dt.c
+++ b/drivers/mtd/nand/raw/denali_dt.c
@@ -115,7 +115,6 @@ static int denali_dt_probe(struct platform_device *pdev)
 	struct denali_dt *dt;
 	const struct denali_dt_data *data;
 	struct denali_controller *denali;
-	struct device_node *np;
 	int ret;
 
 	dt = devm_kzalloc(dev, sizeof(*dt), GFP_KERNEL);
@@ -192,12 +191,10 @@ static int denali_dt_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_assert_rst;
 
-	for_each_child_of_node(dev->of_node, np) {
+	for_each_child_of_node_scoped(dev->of_node, np) {
 		ret = denali_dt_chip_init(denali, np);
-		if (ret) {
-			of_node_put(np);
+		if (ret)
 			goto out_remove_denali;
-		}
 	}
 
 	platform_set_drvdata(pdev, dt);
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/7] mtd: rawnand: ingenic: Simplify with scoped for each OF child loop
  2026-01-02 12:49 [PATCH 1/7] mtd: rawnand: brcm: Simplify with scoped for each OF child loop Krzysztof Kozlowski
  2026-01-02 12:49 ` [PATCH 2/7] mtd: rawnand: denali: " Krzysztof Kozlowski
@ 2026-01-02 12:49 ` Krzysztof Kozlowski
  2026-01-02 22:22   ` Paul Cercueil
  2026-01-02 12:49 ` [PATCH 4/7] mtd: rawnand: qcom: " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:49 UTC (permalink / raw)
  To: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, 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/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
index 47dc3efcee92..f1e2c82936b3 100644
--- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
+++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
@@ -438,7 +438,6 @@ static int ingenic_nand_init_chips(struct ingenic_nfc *nfc,
 				   struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np;
 	int i = 0;
 	int ret;
 	int num_chips = of_get_child_count(dev->of_node);
@@ -449,11 +448,10 @@ static int ingenic_nand_init_chips(struct ingenic_nfc *nfc,
 		return -EINVAL;
 	}
 
-	for_each_child_of_node(dev->of_node, np) {
+	for_each_child_of_node_scoped(dev->of_node, np) {
 		ret = ingenic_nand_init_chip(pdev, nfc, np, i);
 		if (ret) {
 			ingenic_nand_cleanup_chips(nfc);
-			of_node_put(np);
 			return ret;
 		}
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/7] mtd: rawnand: qcom: Simplify with scoped for each OF child loop
  2026-01-02 12:49 [PATCH 1/7] mtd: rawnand: brcm: Simplify with scoped for each OF child loop Krzysztof Kozlowski
  2026-01-02 12:49 ` [PATCH 2/7] mtd: rawnand: denali: " Krzysztof Kozlowski
  2026-01-02 12:49 ` [PATCH 3/7] mtd: rawnand: ingenic: " Krzysztof Kozlowski
@ 2026-01-02 12:49 ` Krzysztof Kozlowski
  2026-01-02 13:59   ` Konrad Dybcio
  2026-01-02 12:49 ` [PATCH 5/7] mtd: rawnand: vf610: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:49 UTC (permalink / raw)
  To: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, 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/mtd/nand/raw/qcom_nandc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index 4dd6f1a4e797..b7e79b76654d 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -2206,16 +2206,14 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc,
 static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
 {
 	struct device *dev = nandc->dev;
-	struct device_node *dn = dev->of_node, *child;
+	struct device_node *dn = dev->of_node;
 	struct qcom_nand_host *host;
 	int ret = -ENODEV;
 
-	for_each_available_child_of_node(dn, child) {
+	for_each_available_child_of_node_scoped(dn, child) {
 		host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
-		if (!host) {
-			of_node_put(child);
+		if (!host)
 			return -ENOMEM;
-		}
 
 		ret = qcom_nand_host_init_and_register(nandc, host, child);
 		if (ret) {
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/7] mtd: rawnand: vf610: Fix Wvoid-pointer-to-enum-cast warning
  2026-01-02 12:49 [PATCH 1/7] mtd: rawnand: brcm: Simplify with scoped for each OF child loop Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2026-01-02 12:49 ` [PATCH 4/7] mtd: rawnand: qcom: " Krzysztof Kozlowski
@ 2026-01-02 12:49 ` Krzysztof Kozlowski
  2026-01-02 12:49 ` [PATCH 6/7] mtd: rawnand: vf610: Simplify with scoped for each OF child loop Krzysztof Kozlowski
  2026-01-02 12:49 ` [PATCH 7/7] mtd: spi-nor: hisi-sfc: " Krzysztof Kozlowski
  5 siblings, 0 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:49 UTC (permalink / raw)
  To: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, llvm
  Cc: Krzysztof Kozlowski

"nfc->variant" is an enum, thus cast of pointer on 64-bit compile test
with clang W=1 causes:

  vf610_nfc.c:843:17: error: cast to smaller integer type 'enum vf610_nfc_variant' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/mtd/nand/raw/vf610_nfc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
index 4b5ba3187853..1955dc50b40a 100644
--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -840,7 +840,7 @@ static int vf610_nfc_probe(struct platform_device *pdev)
 		return PTR_ERR(nfc->clk);
 	}
 
-	nfc->variant = (enum vf610_nfc_variant)device_get_match_data(&pdev->dev);
+	nfc->variant = (unsigned long)device_get_match_data(&pdev->dev);
 	if (!nfc->variant)
 		return -ENODEV;
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/7] mtd: rawnand: vf610: Simplify with scoped for each OF child loop
  2026-01-02 12:49 [PATCH 1/7] mtd: rawnand: brcm: Simplify with scoped for each OF child loop Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2026-01-02 12:49 ` [PATCH 5/7] mtd: rawnand: vf610: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
@ 2026-01-02 12:49 ` Krzysztof Kozlowski
  2026-01-02 12:49 ` [PATCH 7/7] mtd: spi-nor: hisi-sfc: " Krzysztof Kozlowski
  5 siblings, 0 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:49 UTC (permalink / raw)
  To: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, 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/mtd/nand/raw/vf610_nfc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
index 1955dc50b40a..9940681810cf 100644
--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -810,7 +810,6 @@ static int vf610_nfc_probe(struct platform_device *pdev)
 	struct vf610_nfc *nfc;
 	struct mtd_info *mtd;
 	struct nand_chip *chip;
-	struct device_node *child;
 	int err;
 	int irq;
 
@@ -844,13 +843,12 @@ static int vf610_nfc_probe(struct platform_device *pdev)
 	if (!nfc->variant)
 		return -ENODEV;
 
-	for_each_available_child_of_node(nfc->dev->of_node, child) {
+	for_each_available_child_of_node_scoped(nfc->dev->of_node, child) {
 		if (of_device_is_compatible(child, "fsl,vf610-nfc-nandcs")) {
 
 			if (nand_get_flash_node(chip)) {
 				dev_err(nfc->dev,
 					"Only one NAND chip supported!\n");
-				of_node_put(child);
 				return -EINVAL;
 			}
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/7] mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop
  2026-01-02 12:49 [PATCH 1/7] mtd: rawnand: brcm: Simplify with scoped for each OF child loop Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2026-01-02 12:49 ` [PATCH 6/7] mtd: rawnand: vf610: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2026-01-02 12:49 ` Krzysztof Kozlowski
  2026-01-02 13:33   ` Pratyush Yadav
  5 siblings, 1 reply; 13+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-02 12:49 UTC (permalink / raw)
  To: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, 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/mtd/spi-nor/controllers/hisi-sfc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/spi-nor/controllers/hisi-sfc.c b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
index db948da2c4c5..54c49a8423a2 100644
--- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c
+++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
@@ -394,15 +394,12 @@ static void hisi_spi_nor_unregister_all(struct hifmc_host *host)
 static int hisi_spi_nor_register_all(struct hifmc_host *host)
 {
 	struct device *dev = host->dev;
-	struct device_node *np;
 	int ret;
 
-	for_each_available_child_of_node(dev->of_node, np) {
+	for_each_available_child_of_node_scoped(dev->of_node, np) {
 		ret = hisi_spi_nor_register(np, host);
-		if (ret) {
-			of_node_put(np);
+		if (ret)
 			goto fail;
-		}
 
 		if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
 			dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 7/7] mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop
  2026-01-02 12:49 ` [PATCH 7/7] mtd: spi-nor: hisi-sfc: " Krzysztof Kozlowski
@ 2026-01-02 13:33   ` Pratyush Yadav
  2026-01-03 12:38     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 13+ messages in thread
From: Pratyush Yadav @ 2026-01-02 13:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, llvm

Hi Kyzystof,

Thanks for the cleanup.

On Fri, Jan 02 2026, Krzysztof Kozlowski wrote:

> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.

Nit: the commit message is a bit too dry. I had to go and look what the
difference between the two variants was. I could make an educated guess
by looking at the patch, but still.

If you end up doing a v2, a one-liner explanation of the difference
between the two loop variants would be nice to have.

Acked-by: Pratyush Yadav <pratyush@kernel.org>

>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
>  drivers/mtd/spi-nor/controllers/hisi-sfc.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/controllers/hisi-sfc.c b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
> index db948da2c4c5..54c49a8423a2 100644
> --- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c
> +++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
> @@ -394,15 +394,12 @@ static void hisi_spi_nor_unregister_all(struct hifmc_host *host)
>  static int hisi_spi_nor_register_all(struct hifmc_host *host)
>  {
>  	struct device *dev = host->dev;
> -	struct device_node *np;
>  	int ret;
>  
> -	for_each_available_child_of_node(dev->of_node, np) {
> +	for_each_available_child_of_node_scoped(dev->of_node, np) {
>  		ret = hisi_spi_nor_register(np, host);
> -		if (ret) {
> -			of_node_put(np);
> +		if (ret)
>  			goto fail;
> -		}
>  
>  		if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
>  			dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/7] mtd: rawnand: qcom: Simplify with scoped for each OF child loop
  2026-01-02 12:49 ` [PATCH 4/7] mtd: rawnand: qcom: " Krzysztof Kozlowski
@ 2026-01-02 13:59   ` Konrad Dybcio
  0 siblings, 0 replies; 13+ messages in thread
From: Konrad Dybcio @ 2026-01-02 13:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Brian Norris, Kamal Dasu,
	Broadcom internal kernel review list, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Harvey Hunt,
	Paul Cercueil, Manivannan Sadhasivam, Stefan Agner, Tudor Ambarus,
	Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, llvm

On 1/2/26 1:49 PM, 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: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/7] mtd: rawnand: ingenic: Simplify with scoped for each OF child loop
  2026-01-02 12:49 ` [PATCH 3/7] mtd: rawnand: ingenic: " Krzysztof Kozlowski
@ 2026-01-02 22:22   ` Paul Cercueil
  0 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-01-02 22:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Brian Norris, Kamal Dasu,
	Broadcom internal kernel review list, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Harvey Hunt,
	Manivannan Sadhasivam, Stefan Agner, Tudor Ambarus,
	Pratyush Yadav, Michael Walle, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-mtd,
	linux-kernel, linux-mips, linux-arm-msm, llvm

Hi Krzysztof,

Le vendredi 02 janvier 2026 à 13:49 +0100, Krzysztof Kozlowski a
écrit :
> 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: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> index 47dc3efcee92..f1e2c82936b3 100644
> --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
> @@ -438,7 +438,6 @@ static int ingenic_nand_init_chips(struct
> ingenic_nfc *nfc,
>  				   struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> -	struct device_node *np;
>  	int i = 0;
>  	int ret;
>  	int num_chips = of_get_child_count(dev->of_node);
> @@ -449,11 +448,10 @@ static int ingenic_nand_init_chips(struct
> ingenic_nfc *nfc,
>  		return -EINVAL;
>  	}
>  
> -	for_each_child_of_node(dev->of_node, np) {
> +	for_each_child_of_node_scoped(dev->of_node, np) {
>  		ret = ingenic_nand_init_chip(pdev, nfc, np, i);
>  		if (ret) {
>  			ingenic_nand_cleanup_chips(nfc);
> -			of_node_put(np);
>  			return ret;
>  		}
>  

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 7/7] mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop
  2026-01-02 13:33   ` Pratyush Yadav
@ 2026-01-03 12:38     ` Krzysztof Kozlowski
  2026-01-03 23:28       ` Pratyush Yadav
  2026-01-03 23:57       ` Vladimir Zapolskiy
  0 siblings, 2 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-03 12:38 UTC (permalink / raw)
  To: Pratyush Yadav
  Cc: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Michael Walle, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-mtd, linux-kernel, linux-mips,
	linux-arm-msm, llvm

On 02/01/2026 14:33, Pratyush Yadav wrote:
> Hi Kyzystof,
> 
> Thanks for the cleanup.
> 
> On Fri, Jan 02 2026, Krzysztof Kozlowski wrote:
> 
>> Use scoped for-each loop when iterating over device nodes to make code a
>> bit simpler.
> 
> Nit: the commit message is a bit too dry. I had to go and look what the
> difference between the two variants was. I could make an educated guess
> by looking at the patch, but still.

Really? That's old and widely used syntax, replaced so many times and
sorry, but really obvious.

We should not explain core kernel API in commit msgs, except maybe first
months of usage.

> 
> If you end up doing a v2, a one-liner explanation of the difference
> between the two loop variants would be nice to have.



Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 7/7] mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop
  2026-01-03 12:38     ` Krzysztof Kozlowski
@ 2026-01-03 23:28       ` Pratyush Yadav
  2026-01-03 23:57       ` Vladimir Zapolskiy
  1 sibling, 0 replies; 13+ messages in thread
From: Pratyush Yadav @ 2026-01-03 23:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Michael Walle, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-mtd, linux-kernel, linux-mips,
	linux-arm-msm, llvm

(writing from my phone so please excuse the formatting)

On Sat, Jan 3, 2026, at 1:38 PM, Krzysztof Kozlowski wrote:
> On 02/01/2026 14:33, Pratyush Yadav wrote:
>> Hi Kyzystof,
>> 
>> Thanks for the cleanup.
>> 
>> On Fri, Jan 02 2026, Krzysztof Kozlowski wrote:
>> 
>>> Use scoped for-each loop when iterating over device nodes to make code a
>>> bit simpler.
>> 
>> Nit: the commit message is a bit too dry. I had to go and look what the
>> difference between the two variants was. I could make an educated guess
>> by looking at the patch, but still.
>
> Really? That's old and widely used syntax, replaced so many times and
> sorry, but really obvious.
>
> We should not explain core kernel API in commit msgs, except maybe first
> months of usage.

Dunno. It's the first time I'm seeing these. So this was my first reaction. I think the patch would read nicer if you explain why the new variant is better even if it is widely used.

Anyway, I don't want to waste either of our energy arguing this, so if you don't want to add the one liner, that's fine by me too.

>> 
>> If you end up doing a v2, a one-liner explanation of the difference
>> between the two loop variants would be nice to have.

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 7/7] mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop
  2026-01-03 12:38     ` Krzysztof Kozlowski
  2026-01-03 23:28       ` Pratyush Yadav
@ 2026-01-03 23:57       ` Vladimir Zapolskiy
  1 sibling, 0 replies; 13+ messages in thread
From: Vladimir Zapolskiy @ 2026-01-03 23:57 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Pratyush Yadav, Jonathan Cameron
  Cc: Brian Norris, Kamal Dasu, Broadcom internal kernel review list,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Harvey Hunt, Paul Cercueil, Manivannan Sadhasivam, Stefan Agner,
	Tudor Ambarus, Michael Walle, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-mtd, linux-kernel, linux-mips,
	linux-arm-msm, llvm

On 1/3/26 14:38, Krzysztof Kozlowski wrote:
> On 02/01/2026 14:33, Pratyush Yadav wrote:
>> Hi Kyzystof,
>>
>> Thanks for the cleanup.
>>
>> On Fri, Jan 02 2026, Krzysztof Kozlowski wrote:
>>
>>> Use scoped for-each loop when iterating over device nodes to make code a
>>> bit simpler.
>>
>> Nit: the commit message is a bit too dry. I had to go and look what the
>> difference between the two variants was. I could make an educated guess
>> by looking at the patch, but still.
> 
> Really? That's old and widely used syntax, replaced so many times and
> sorry, but really obvious.

The made conversion changes are not exactly the ones, which were asked to
be done.

Commit 34af4554fb0c ("of: Introduce for_each_*_child_of_node_scoped()
to automate of_node_put() handling") says it clearly:

     Note that, in the vast majority of cases, the _available_ form should be
     used and as code is converted to these scoped handers, we should confirm
     that any cases that do not check for available have a good reason not
     to.

So, likely this and many other similar changes miss information in their
commit messages, why for_each_available_child_of_node_scoped() form is
inapplicable, thus it still could be improved.

> We should not explain core kernel API in commit msgs, except maybe first
> months of usage.
> 
>>
>> If you end up doing a v2, a one-liner explanation of the difference
>> between the two loop variants would be nice to have.
> 

-- 
Best wishes,
Vladimir

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-01-03 23:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 12:49 [PATCH 1/7] mtd: rawnand: brcm: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-02 12:49 ` [PATCH 2/7] mtd: rawnand: denali: " Krzysztof Kozlowski
2026-01-02 12:49 ` [PATCH 3/7] mtd: rawnand: ingenic: " Krzysztof Kozlowski
2026-01-02 22:22   ` Paul Cercueil
2026-01-02 12:49 ` [PATCH 4/7] mtd: rawnand: qcom: " Krzysztof Kozlowski
2026-01-02 13:59   ` Konrad Dybcio
2026-01-02 12:49 ` [PATCH 5/7] mtd: rawnand: vf610: Fix Wvoid-pointer-to-enum-cast warning Krzysztof Kozlowski
2026-01-02 12:49 ` [PATCH 6/7] mtd: rawnand: vf610: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2026-01-02 12:49 ` [PATCH 7/7] mtd: spi-nor: hisi-sfc: " Krzysztof Kozlowski
2026-01-02 13:33   ` Pratyush Yadav
2026-01-03 12:38     ` Krzysztof Kozlowski
2026-01-03 23:28       ` Pratyush Yadav
2026-01-03 23:57       ` Vladimir Zapolskiy

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).