xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Campbell <ian.campbell@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>
Subject: [PATCH 03/11] device tree: follow coding style
Date: Mon, 19 Mar 2012 17:52:01 +0000	[thread overview]
Message-ID: <1332179529-1828-4-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1332179529-1828-1-git-send-email-david.vrabel@citrix.com>

From: David Vrabel <david.vrabel@citrix.com>

Only changes to the coding style, no functional changes.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
 xen/common/device_tree.c |   48 ++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 140d342..4a7166d 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -27,25 +27,28 @@ static void __init get_val(const u32 **cell, u32 cells, u64 *val)
 {
     *val = 0;
 
-    while (cells--) {
+    while ( cells-- )
+    {
         *val <<= 32;
         *val |= fdt32_to_cpu(*(*cell)++);
     }
 }
 
-static void __init get_register(const u32 **cell, u32 address_cells, u32 size_cells,
+static void __init get_register(const u32 **cell,
+                                u32 address_cells, u32 size_cells,
                                 u64 *start, u64 *size)
 {
     get_val(cell, address_cells, start);
     get_val(cell, size_cells, size);
 }
 
-static u32 __init prop_by_name_u32(const void *fdt, int node, const char *prop_name)
+static u32 __init prop_by_name_u32(const void *fdt, int node,
+                                   const char *prop_name)
 {
     const struct fdt_property *prop;
 
     prop = fdt_get_property(fdt, node, prop_name, NULL);
-    if (!prop || prop->len < sizeof(u32))
+    if ( !prop || prop->len < sizeof(u32) )
         return 0; /* default to 0 */
 
     return fdt32_to_cpu(*(uint32_t*)prop->data);
@@ -61,14 +64,16 @@ static void __init process_memory_node(const void *fdt, int node,
     const u32 *cell;
     paddr_t start, size;
 
-    if (address_cells < 1 || size_cells < 1) {
+    if ( address_cells < 1 || size_cells < 1 )
+    {
         early_printk("fdt: node `%s': invalid #address-cells or #size-cells",
                      fdt_get_name(fdt, node, NULL));
         return;
     }
 
     prop = fdt_get_property(fdt, node, "reg", NULL);
-    if (!prop) {
+    if ( !prop )
+    {
         early_printk("fdt: node `%s': missing `reg' property\n",
                      fdt_get_name(fdt, node, NULL));
         return;
@@ -78,7 +83,8 @@ static void __init process_memory_node(const void *fdt, int node,
     reg_cells = address_cells + size_cells;
     banks = fdt32_to_cpu(prop->len) / (reg_cells * sizeof(u32));
 
-    for (i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++) {
+    for ( i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++ )
+    {
         get_register(&cell, address_cells, size_cells, &start, &size);
         early_info.mem.bank[early_info.mem.nr_banks].start = start;
         early_info.mem.bank[early_info.mem.nr_banks].size = size;
@@ -96,10 +102,12 @@ static void __init early_scan(const void *fdt)
     u32 address_cells[MAX_DEPTH];
     u32 size_cells[MAX_DEPTH];
 
-    for (node = 0; depth >= 0; node = fdt_next_node(fdt, node, &depth)) {
+    for ( node = 0; depth >= 0; node = fdt_next_node(fdt, node, &depth) )
+    {
         name = fdt_get_name(fdt, node, NULL);
 
-        if (depth >= MAX_DEPTH) {
+        if ( depth >= MAX_DEPTH )
+        {
             early_printk("fdt: node '%s': nested too deep\n",
                          fdt_get_name(fdt, node, NULL));
             continue;
@@ -108,8 +116,9 @@ static void __init early_scan(const void *fdt)
         address_cells[depth] = prop_by_name_u32(fdt, node, "#address-cells");
         size_cells[depth] = prop_by_name_u32(fdt, node, "#size-cells");
 
-        if (strncmp(name, "memory", 6) == 0)
-            process_memory_node(fdt, node, address_cells[depth-1], size_cells[depth-1]);
+        if ( strncmp(name, "memory", 6) == 0 )
+            process_memory_node(fdt, node,
+                                address_cells[depth-1], size_cells[depth-1]);
     }
 }
 
@@ -118,9 +127,10 @@ static void __init early_print_info(void)
     struct dt_mem_info *mi = &early_info.mem;
     int i;
 
-    for (i = 0; i < mi->nr_banks; i++)
+    for ( i = 0; i < mi->nr_banks; i++ )
         early_printk("RAM: %016llx - %016llx\n",
-                     mi->bank[i].start, mi->bank[i].start + mi->bank[i].size - 1);
+                     mi->bank[i].start,
+                     mi->bank[i].start + mi->bank[i].size - 1);
 }
 
 /**
@@ -134,7 +144,7 @@ size_t __init device_tree_early_init(const void *fdt)
     int ret;
 
     ret = fdt_check_header(fdt);
-    if (ret < 0)
+    if ( ret < 0 )
         early_panic("No valid device tree\n");
 
     early_scan(fdt);
@@ -159,15 +169,17 @@ paddr_t __init device_tree_get_xen_paddr(void)
     min_size = (_end - _start + (XEN_PADDR_ALIGN-1)) & ~(XEN_PADDR_ALIGN-1);
 
     /* Find the highest bank with enough space. */
-    for (i = 0; i < mi->nr_banks; i++) {
-        if (mi->bank[i].size >= min_size) {
+    for ( i = 0; i < mi->nr_banks; i++ )
+    {
+        if ( mi->bank[i].size >= min_size )
+        {
             t = mi->bank[i].start + mi->bank[i].size - min_size;
-            if (t > paddr)
+            if ( t > paddr )
                 paddr = t;
         }
     }
 
-    if (!paddr)
+    if ( !paddr )
         early_panic("Not enough memory to relocate Xen\n");
 
     return paddr;
-- 
1.7.2.5

  parent reply	other threads:[~2012-03-19 17:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 17:51 [PATCHv2 00/11] arm: pass a device tree to dom0 David Vrabel
2012-03-19 17:51 ` [PATCH 01/11] libfdt: move headers to xen/include/xen/libfdt/ David Vrabel
2012-03-19 17:58   ` David Vrabel
2012-03-19 17:52 ` [PATCH 02/11] MAINTAINERS: add device tree maintainer David Vrabel
2012-03-19 17:54   ` Keir Fraser
2012-03-19 17:52 ` David Vrabel [this message]
2012-03-19 17:52 ` [PATCH 04/11] device tree: correctly ignore unit-address when matching nodes by name David Vrabel
2012-03-19 17:52 ` [PATCH 05/11] device tree: add device_tree_for_each_node() David Vrabel
2012-03-22 11:12   ` Ian Campbell
2012-03-22 12:47     ` David Vrabel
2012-03-19 17:52 ` [PATCH 06/11] device tree: add device_tree_dump() to print a flat device tree David Vrabel
2012-03-19 17:52 ` [PATCH 07/11] arm: remove the hack for loading vmlinux images David Vrabel
2012-03-19 17:52 ` [PATCH 08/11] device tree, arm: supply a flat device tree to dom0 David Vrabel
2012-03-20 10:43   ` David Vrabel
2012-03-20 10:52     ` Ian Campbell
2012-03-22 14:06   ` Ian Campbell
2012-03-22 14:27     ` David Vrabel
2012-03-22 17:12     ` David Vrabel
2012-03-19 17:52 ` [PATCH 09/11] Allow cmdline_parse() to be used with const strings David Vrabel
2012-03-19 17:54   ` Keir Fraser
2012-03-19 17:52 ` [PATCH 10/11] arm: use bootargs for the command line David Vrabel
2012-03-22 14:22   ` Ian Campbell
2012-03-22 14:30     ` Ian Campbell
2012-03-22 15:03     ` David Vrabel
2012-03-19 17:52 ` [PATCH 11/11] arm: add dom0_mem command line argument David Vrabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332179529-1828-4-git-send-email-david.vrabel@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).