]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
treewide: use _scoped for loops 23872/head
authorRosen Penev <rosenp@gmail.com>
Thu, 4 Dec 2025 04:48:57 +0000 (20:48 -0800)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Sat, 20 Jun 2026 08:03:00 +0000 (10:03 +0200)
Done for local patches. Potential upstreaming will be using these
anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23872
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/generic/files/drivers/net/phy/b53/b53_common.c
target/linux/generic/hack-6.12/421-drivers-mtd-parsers-add-nvmem-support-to-cmdlinepart.patch
target/linux/generic/hack-6.12/800-GPIO-add-named-gpio-exports.patch
target/linux/generic/hack-6.18/421-drivers-mtd-parsers-add-nvmem-support-to-cmdlinepart.patch
target/linux/generic/hack-6.18/800-GPIO-add-named-gpio-exports.patch

index 1130afdd9c1de054dcf9717b448da5759fe4d1c4..0a698cca78c306a8a398b005aae501656c65e2e2 100644 (file)
@@ -566,6 +566,7 @@ static int b53_configure_ports_of(struct b53_device *dev)
                }
        }
 
+       of_node_put(dn);
        return 0;
 }
 
index 190fecc1a0eae85c50bc151c7809b55a582d49c5..9f8f8c112c81cc63862c66c9b56a9f5fa40060b5 100644 (file)
@@ -27,7 +27,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
  
  /* special size referring to all the remaining space in a partition */
  #define SIZE_REMAINING ULLONG_MAX
-@@ -315,6 +316,68 @@ static int mtdpart_setup_real(char *s)
+@@ -315,6 +316,67 @@ static int mtdpart_setup_real(char *s)
        return 0;
  }
  
@@ -37,7 +37,6 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
 +{
 +      struct device_node *mtd_node;
 +      struct device_node *ofpart_node;
-+      struct device_node *pp;
 +      struct mtd_partition part;
 +      const char *partname;
 +
@@ -47,7 +46,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
 +
 +      ofpart_node = of_get_child_by_name(mtd_node, "partitions");
 +
-+      for_each_child_of_node(ofpart_node,  pp) {
++      for_each_child_of_node_scoped(ofpart_node, pp) {
 +              const __be32 *reg;
 +              int len;
 +              int a_cells, s_cells;
@@ -71,7 +70,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
 +
 +              part.offset = of_read_number(reg, a_cells);
 +              part.size = of_read_number(reg + a_cells, s_cells);
-+              part.of_node = pp;
++              part.of_node = of_node_get(pp);
 +
 +              partname = of_get_property(pp, "label", &len);
 +              if (!partname)
@@ -96,7 +95,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
  /*
   * Main function to be called from the MTD mapping driver/device to
   * obtain the partitioning information. At this point the command line
-@@ -330,6 +393,7 @@ static int parse_cmdline_partitions(stru
+@@ -330,6 +392,7 @@ static int parse_cmdline_partitions(stru
        int i, err;
        struct cmdline_mtd_partition *part;
        const char *mtd_id = master->name;
@@ -104,7 +103,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
  
        /* parse command line */
        if (!cmdline_parsed) {
-@@ -374,6 +438,13 @@ static int parse_cmdline_partitions(stru
+@@ -374,6 +437,13 @@ static int parse_cmdline_partitions(stru
                                sizeof(*part->parts) * (part->num_parts - i));
                        i--;
                }
index fe2b19c5632234124508776fe461fa8808d3c93b..367ad69664c01c5cf68e87b52146ae9efdeb5789 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
  #include "gpiolib.h"
  #include "gpiolib-of.h"
-@@ -1205,3 +1207,73 @@ void of_gpiochip_remove(struct gpio_chip
+@@ -1205,3 +1207,72 @@ void of_gpiochip_remove(struct gpio_chip
  
        of_node_put(np);
  }
@@ -30,11 +30,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +static int of_gpio_export_probe(struct platform_device *pdev)
 +{
 +      struct device_node *np = pdev->dev.of_node;
-+      struct device_node *cnp;
 +      u32 val;
 +      int nb = 0;
 +
-+      for_each_child_of_node(np, cnp) {
++      for_each_child_of_node_scoped(np, cnp) {
 +              const char *name = NULL;
 +              int gpio;
 +              bool dmc;
index 190fecc1a0eae85c50bc151c7809b55a582d49c5..9f8f8c112c81cc63862c66c9b56a9f5fa40060b5 100644 (file)
@@ -27,7 +27,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
  
  /* special size referring to all the remaining space in a partition */
  #define SIZE_REMAINING ULLONG_MAX
-@@ -315,6 +316,68 @@ static int mtdpart_setup_real(char *s)
+@@ -315,6 +316,67 @@ static int mtdpart_setup_real(char *s)
        return 0;
  }
  
@@ -37,7 +37,6 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
 +{
 +      struct device_node *mtd_node;
 +      struct device_node *ofpart_node;
-+      struct device_node *pp;
 +      struct mtd_partition part;
 +      const char *partname;
 +
@@ -47,7 +46,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
 +
 +      ofpart_node = of_get_child_by_name(mtd_node, "partitions");
 +
-+      for_each_child_of_node(ofpart_node,  pp) {
++      for_each_child_of_node_scoped(ofpart_node, pp) {
 +              const __be32 *reg;
 +              int len;
 +              int a_cells, s_cells;
@@ -71,7 +70,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
 +
 +              part.offset = of_read_number(reg, a_cells);
 +              part.size = of_read_number(reg + a_cells, s_cells);
-+              part.of_node = pp;
++              part.of_node = of_node_get(pp);
 +
 +              partname = of_get_property(pp, "label", &len);
 +              if (!partname)
@@ -96,7 +95,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
  /*
   * Main function to be called from the MTD mapping driver/device to
   * obtain the partitioning information. At this point the command line
-@@ -330,6 +393,7 @@ static int parse_cmdline_partitions(stru
+@@ -330,6 +392,7 @@ static int parse_cmdline_partitions(stru
        int i, err;
        struct cmdline_mtd_partition *part;
        const char *mtd_id = master->name;
@@ -104,7 +103,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
  
        /* parse command line */
        if (!cmdline_parsed) {
-@@ -374,6 +438,13 @@ static int parse_cmdline_partitions(stru
+@@ -374,6 +437,13 @@ static int parse_cmdline_partitions(stru
                                sizeof(*part->parts) * (part->num_parts - i));
                        i--;
                }
index 63a49702f771c4999c7a58498cbda2b3b8641381..a18015d0b92bfe7c49a026f5b64cb14c8a760ead 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
  #include "gpiolib.h"
  #include "gpiolib-of.h"
-@@ -1302,3 +1304,73 @@ bool of_gpiochip_instance_match(struct g
+@@ -1302,3 +1304,72 @@ bool of_gpiochip_instance_match(struct g
  
        return false;
  }
@@ -30,11 +30,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +static int of_gpio_export_probe(struct platform_device *pdev)
 +{
 +      struct device_node *np = pdev->dev.of_node;
-+      struct device_node *cnp;
 +      u32 val;
 +      int nb = 0;
 +
-+      for_each_child_of_node(np, cnp) {
++      for_each_child_of_node_scoped(np, cnp) {
 +              const char *name = NULL;
 +              int gpio;
 +              bool dmc;