[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] xen: arm: correct name of the dt node passed around when building dom0 DT



The argument is the node, not the parent. I think this stems from the use of
the name "np" in other places (confusing "node parent" for "node pointer").
Therefore replace all uses of either "parent" or "np" with "node".

In addition in write_properties now that np=>node the name pp makes no sense.
Rename it to "prop".

No semantic change.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/domain_build.c |   98 +++++++++++++++++++++----------------------
 1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index d79e038..7626c96 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -153,10 +153,10 @@ static void allocate_memory(struct domain *d, struct 
kernel_info *kinfo)
 }
 
 static int write_properties(struct domain *d, struct kernel_info *kinfo,
-                            const struct dt_device_node *np)
+                            const struct dt_device_node *node)
 {
     const char *bootargs = NULL;
-    const struct dt_property *pp;
+    const struct dt_property *prop;
     int res = 0;
     int had_dom0_bootargs = 0;
 
@@ -164,11 +164,11 @@ static int write_properties(struct domain *d, struct 
kernel_info *kinfo,
          early_info.modules.module[MOD_KERNEL].cmdline[0] )
         bootargs = &early_info.modules.module[MOD_KERNEL].cmdline[0];
 
-    dt_for_each_property_node (np, pp)
+    dt_for_each_property_node (node, prop)
     {
-        const void *prop_data = pp->value;
+        const void *prop_data = prop->value;
         void *new_data = NULL;
-        u32 prop_len = pp->length;
+        u32 prop_len = prop->length;
 
         /*
          * In chosen node:
@@ -178,28 +178,28 @@ static int write_properties(struct domain *d, struct 
kernel_info *kinfo,
          * * remove bootargs,  xen,dom0-bootargs, xen,xen-bootargs,
          *   linux,initrd-start and linux,initrd-end.
          */
-        if ( dt_node_path_is_equal(np, "/chosen") )
+        if ( dt_node_path_is_equal(node, "/chosen") )
         {
-            if ( dt_property_name_is_equal(pp, "xen,xen-bootargs") ||
-                 dt_property_name_is_equal(pp, "linux,initrd-start") ||
-                 dt_property_name_is_equal(pp, "linux,initrd-end") )
+            if ( dt_property_name_is_equal(prop, "xen,xen-bootargs") ||
+                 dt_property_name_is_equal(prop, "linux,initrd-start") ||
+                 dt_property_name_is_equal(prop, "linux,initrd-end") )
                 continue;
 
-            if ( dt_property_name_is_equal(pp, "xen,dom0-bootargs") )
+            if ( dt_property_name_is_equal(prop, "xen,dom0-bootargs") )
             {
                 had_dom0_bootargs = 1;
-                bootargs = pp->value;
+                bootargs = prop->value;
                 continue;
             }
-            if ( dt_property_name_is_equal(pp, "bootargs") )
+            if ( dt_property_name_is_equal(prop, "bootargs") )
             {
                 if ( !bootargs  && !had_dom0_bootargs )
-                    bootargs = pp->value;
+                    bootargs = prop->value;
                 continue;
             }
         }
 
-        res = fdt_property(kinfo->fdt, pp->name, prop_data, prop_len);
+        res = fdt_property(kinfo->fdt, prop->name, prop_data, prop_len);
 
         xfree(new_data);
 
@@ -207,7 +207,7 @@ static int write_properties(struct domain *d, struct 
kernel_info *kinfo,
             return res;
     }
 
-    if ( dt_node_path_is_equal(np, "/chosen") && bootargs )
+    if ( dt_node_path_is_equal(node, "/chosen") && bootargs )
     {
         res = fdt_property(kinfo->fdt, "bootargs", bootargs,
                            strlen(bootargs) + 1);
@@ -276,11 +276,11 @@ static int fdt_property_interrupts(void *fdt, 
gic_interrupt_t *intr,
 
 static int make_memory_node(const struct domain *d,
                             void *fdt,
-                            const struct dt_device_node *parent,
+                            const struct dt_device_node *node,
                             const struct kernel_info *kinfo)
 {
     int res, i;
-    int reg_size = dt_n_addr_cells(parent) + dt_n_size_cells(parent);
+    int reg_size = dt_n_addr_cells(node) + dt_n_size_cells(node);
     int nr_cells = reg_size*kinfo->mem.nr_banks;
     __be32 reg[nr_cells];
     __be32 *cells;
@@ -305,7 +305,7 @@ static int make_memory_node(const struct domain *d,
         DPRINT("  Bank %d: %#"PRIx64"->%#"PRIx64"\n",
                 i, start, start + size);
 
-        dt_set_range(&cells, parent, start, size);
+        dt_set_range(&cells, node, start, size);
     }
 
     res = fdt_property(fdt, "reg", reg, sizeof(reg));
@@ -318,7 +318,7 @@ static int make_memory_node(const struct domain *d,
 }
 
 static int make_hypervisor_node(struct domain *d,
-                                void *fdt, const struct dt_device_node *parent)
+                                void *fdt, const struct dt_device_node *node)
 {
     const char compat[] =
         "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0"
@@ -327,8 +327,8 @@ static int make_hypervisor_node(struct domain *d,
     gic_interrupt_t intr;
     __be32 *cells;
     int res;
-    int addrcells = dt_n_addr_cells(parent);
-    int sizecells = dt_n_size_cells(parent);
+    int addrcells = dt_n_addr_cells(node);
+    int sizecells = dt_n_size_cells(node);
 
     DPRINT("Create hypervisor node\n");
 
@@ -353,7 +353,7 @@ static int make_hypervisor_node(struct domain *d,
     DPRINT("  Grant table range: 0xb0000000-0x20000\n");
     /* reg 0 is grant table space */
     cells = &reg[0];
-    dt_set_range(&cells, parent, 0xb0000000, 0x20000);
+    dt_set_range(&cells, node, 0xb0000000, 0x20000);
     res = fdt_property(fdt, "reg", reg,
                        dt_cells_to_size(addrcells + sizecells));
     if ( res )
@@ -379,7 +379,7 @@ static int make_hypervisor_node(struct domain *d,
     return res;
 }
 
-static int make_psci_node(void *fdt, const struct dt_device_node *parent)
+static int make_psci_node(void *fdt, const struct dt_device_node *node)
 {
     int res;
 
@@ -412,7 +412,7 @@ static int make_psci_node(void *fdt, const struct 
dt_device_node *parent)
 }
 
 static int make_cpus_node(const struct domain *d, void *fdt,
-                          const struct dt_device_node *parent)
+                          const struct dt_device_node *node)
 {
     int res;
     const struct dt_device_node *cpus = dt_find_node_by_path("/cpus");
@@ -516,7 +516,7 @@ static int make_cpus_node(const struct domain *d, void *fdt,
 }
 
 static int make_gic_node(const struct domain *d, void *fdt,
-                         const struct dt_device_node *parent)
+                         const struct dt_device_node *node)
 {
     const struct dt_device_node *gic = dt_interrupt_controller;
     const void *compatible = NULL;
@@ -528,7 +528,7 @@ static int make_gic_node(const struct domain *d, void *fdt,
      * Xen currently supports only a single GIC. Discard any secondary
      * GIC entries.
      */
-    if ( parent != dt_interrupt_controller )
+    if ( node != dt_interrupt_controller )
     {
         DPRINT("  Skipping (secondary GIC)\n");
         return 0;
@@ -560,7 +560,7 @@ static int make_gic_node(const struct domain *d, void *fdt,
     if ( res )
         return res;
 
-    len = dt_cells_to_size(dt_n_addr_cells(parent) + dt_n_size_cells(parent));
+    len = dt_cells_to_size(dt_n_addr_cells(node) + dt_n_size_cells(node));
     len *= 2; /* GIC has two memory regions: Distributor + CPU interface */
     new_cells = xzalloc_bytes(len);
     if ( new_cells == NULL )
@@ -569,11 +569,11 @@ static int make_gic_node(const struct domain *d, void 
*fdt,
     tmp = new_cells;
     DPRINT("  Set Distributor Base 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
            d->arch.vgic.dbase, d->arch.vgic.dbase + PAGE_SIZE - 1);
-    dt_set_range(&tmp, parent, d->arch.vgic.dbase, PAGE_SIZE);
+    dt_set_range(&tmp, node, d->arch.vgic.dbase, PAGE_SIZE);
 
     DPRINT("  Set Cpu Base 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
            d->arch.vgic.cbase, d->arch.vgic.cbase + (PAGE_SIZE * 2) - 1);
-    dt_set_range(&tmp, parent, d->arch.vgic.cbase, PAGE_SIZE * 2);
+    dt_set_range(&tmp, node, d->arch.vgic.cbase, PAGE_SIZE * 2);
 
     res = fdt_property(fdt, "reg", new_cells, len);
     xfree(new_cells);
@@ -599,7 +599,7 @@ static int make_gic_node(const struct domain *d, void *fdt,
 }
 
 static int make_timer_node(const struct domain *d, void *fdt,
-                           const struct dt_device_node *parent)
+                           const struct dt_device_node *node)
 {
     static const struct dt_device_match timer_ids[] __initconst =
     {
@@ -740,7 +740,7 @@ static int map_device(struct domain *d, const struct 
dt_device_node *dev)
 }
 
 static int handle_node(struct domain *d, struct kernel_info *kinfo,
-                       const struct dt_device_node *np)
+                       const struct dt_device_node *node)
 {
     static const struct dt_device_match skip_matches[] __initconst =
     {
@@ -766,17 +766,17 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
     const char *name;
     const char *path;
 
-    path = dt_node_full_name(np);
+    path = dt_node_full_name(node);
 
     DPRINT("handle %s\n", path);
 
     /* Skip theses nodes and the sub-nodes */
-    if ( dt_match_node(skip_matches, np ) )
+    if ( dt_match_node(skip_matches, node ) )
     {
         DPRINT("  Skip it (matched)\n");
         return 0;
     }
-    if ( platform_device_is_blacklisted(np) )
+    if ( platform_device_is_blacklisted(node) )
     {
         DPRINT("  Skip it (blacklisted)\n");
         return 0;
@@ -784,13 +784,13 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
 
     /* Replace these nodes with our own. Note that the original may be
      * used_by DOMID_XEN so this check comes first. */
-    if ( dt_match_node(gic_matches, np ) )
-        return make_gic_node(d, kinfo->fdt, np);
-    if ( dt_match_node(timer_matches, np ) )
-        return make_timer_node(d, kinfo->fdt, np);
+    if ( dt_match_node(gic_matches, node ) )
+        return make_gic_node(d, kinfo->fdt, node);
+    if ( dt_match_node(timer_matches, node ) )
+        return make_timer_node(d, kinfo->fdt, node);
 
     /* Skip nodes used by Xen */
-    if ( dt_device_used_by(np) == DOMID_XEN )
+    if ( dt_device_used_by(node) == DOMID_XEN )
     {
         DPRINT("  Skip it (used by Xen)\n");
         return 0;
@@ -804,10 +804,10 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
      *  property. Therefore these device doesn't need to be mapped. This
      *  solution can be use later for pass through.
      */
-    if ( !dt_device_type_is_equal(np, "memory") &&
-         dt_device_is_available(np) )
+    if ( !dt_device_type_is_equal(node, "memory") &&
+         dt_device_is_available(node) )
     {
-        res = map_device(d, np);
+        res = map_device(d, node);
 
         if ( res )
             return res;
@@ -825,32 +825,32 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
     if ( res )
         return res;
 
-    res = write_properties(d, kinfo, np);
+    res = write_properties(d, kinfo, node);
     if ( res )
         return res;
 
-    for ( child = np->child; child != NULL; child = child->sibling )
+    for ( child = node->child; child != NULL; child = child->sibling )
     {
         res = handle_node(d, kinfo, child);
         if ( res )
             return res;
     }
 
-    if ( np == dt_host )
+    if ( node == dt_host )
     {
-        res = make_hypervisor_node(d, kinfo->fdt, np);
+        res = make_hypervisor_node(d, kinfo->fdt, node);
         if ( res )
             return res;
 
-        res = make_psci_node(kinfo->fdt, np);
+        res = make_psci_node(kinfo->fdt, node);
         if ( res )
             return res;
 
-        res = make_cpus_node(d, kinfo->fdt, np);
+        res = make_cpus_node(d, kinfo->fdt, node);
         if ( res )
             return res;
 
-        res = make_memory_node(d, kinfo->fdt, np, kinfo);
+        res = make_memory_node(d, kinfo->fdt, node, kinfo);
         if ( res )
             return res;
 
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.