diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-03-15 00:06:34 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:55:23 -0700 |
commit | 0015d3d68c84eb33e6b380802ad61b23f7eb6523 (patch) | |
tree | d3e7b31dc8a3a34c3625abb0e52de733829e995b /arch | |
parent | d78d0891d3dd976a2fb707c6c691d9cd5ed60727 (diff) | |
download | blackbird-op-linux-0015d3d68c84eb33e6b380802ad61b23f7eb6523.tar.gz blackbird-op-linux-0015d3d68c84eb33e6b380802ad61b23f7eb6523.zip |
[SPARC64]: Simplify read_obp_memory().
Kick out empty entries as soon as we spot them, and use memmove()
instead of a silly loop to make the operation more clear.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc64/mm/init.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index f146071a4b2a..973c4e122f28 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -122,24 +122,19 @@ static void __init read_obp_memory(const char *property, size = 0UL; base = new_base; } - regs[i].phys_addr = base; - regs[i].reg_size = size; - } - - for (i = 0; i < ents; i++) { - if (regs[i].reg_size == 0UL) { - int j; - - for (j = i; j < ents - 1; j++) { - regs[j].phys_addr = - regs[j+1].phys_addr; - regs[j].reg_size = - regs[j+1].reg_size; - } - - ents--; + if (size == 0UL) { + /* If it is empty, simply get rid of it. + * This simplifies the logic of the other + * functions that process these arrays. + */ + memmove(®s[i], ®s[i + 1], + (ents - i - 1) * sizeof(regs[0])); i--; + ents--; + continue; } + regs[i].phys_addr = base; + regs[i].reg_size = size; } *num_ents = ents; |