Skip to content

Commit

Permalink
of/flattree: merge of_get_flat_dt_root
Browse files Browse the repository at this point in the history
Merge common code between PowerPC and MicroBlaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
  • Loading branch information
Grant Likely committed Nov 24, 2009
1 parent c8cb7a5 commit 819d281
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
12 changes: 0 additions & 12 deletions arch/microblaze/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,6 @@ typedef u32 cell_t;
/* export that to outside world */
struct device_node *of_chosen;

unsigned long __init of_get_flat_dt_root(void)
{
unsigned long p = ((unsigned long)initial_boot_params) +
initial_boot_params->off_dt_struct;

while (*((u32 *)p) == OF_DT_NOP)
p += 4;
BUG_ON(*((u32 *)p) != OF_DT_BEGIN_NODE);
p += 4;
return _ALIGN(p + strlen((char *)p) + 1, 4);
}

/**
* This function can be used within scan_flattened_dt callback to get
* access to properties
Expand Down
12 changes: 0 additions & 12 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,6 @@ extern rwlock_t devtree_lock; /* temporary while merging */
/* export that to outside world */
struct device_node *of_chosen;

unsigned long __init of_get_flat_dt_root(void)
{
unsigned long p = ((unsigned long)initial_boot_params) +
initial_boot_params->off_dt_struct;

while(*((u32 *)p) == OF_DT_NOP)
p += 4;
BUG_ON (*((u32 *)p) != OF_DT_BEGIN_NODE);
p += 4;
return _ALIGN(p + strlen((char *)p) + 1, 4);
}

/**
* This function can be used within scan_flattened_dt callback to get
* access to properties
Expand Down
16 changes: 16 additions & 0 deletions drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,19 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,

return rc;
}

/**
* of_get_flat_dt_root - find the root node in the flat blob
*/
unsigned long __init of_get_flat_dt_root(void)
{
unsigned long p = ((unsigned long)initial_boot_params) +
initial_boot_params->off_dt_struct;

while (*((u32 *)p) == OF_DT_NOP)
p += 4;
BUG_ON(*((u32 *)p) != OF_DT_BEGIN_NODE);
p += 4;
return _ALIGN(p + strlen((char *)p) + 1, 4);
}

0 comments on commit 819d281

Please sign in to comment.