Commit 0015d3d6 authored by David S. Miller's avatar David S. Miller

[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: default avatarDavid S. Miller <davem@davemloft.net>
parent d78d0891
...@@ -122,24 +122,19 @@ static void __init read_obp_memory(const char *property, ...@@ -122,24 +122,19 @@ static void __init read_obp_memory(const char *property,
size = 0UL; size = 0UL;
base = new_base; base = new_base;
} }
regs[i].phys_addr = base; if (size == 0UL) {
regs[i].reg_size = size; /* If it is empty, simply get rid of it.
} * This simplifies the logic of the other
* functions that process these arrays.
for (i = 0; i < ents; i++) { */
if (regs[i].reg_size == 0UL) { memmove(&regs[i], &regs[i + 1],
int j; (ents - i - 1) * sizeof(regs[0]));
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--;
i--; i--;
ents--;
continue;
} }
regs[i].phys_addr = base;
regs[i].reg_size = size;
} }
*num_ents = ents; *num_ents = ents;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment