common/memsize.c: Coding style cleanup

Prepare code to make later modifications checkpatch-clean.

Signed-off-by: Wolfgang Denk <wd@denx.de>
master
Wolfgang Denk 11 years ago committed by Tom Rini
parent c7cb334d14
commit 95099fee40
  1. 31
      common/memsize.c

@ -33,43 +33,46 @@ long get_ram_size(long *base, long maxsize)
long size; long size;
int i = 0; int i = 0;
for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) { for (cnt = (maxsize / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) {
addr = base + cnt; /* pointer arith! */ addr = base + cnt; /* pointer arith! */
sync (); sync();
save[i++] = *addr; save[i++] = *addr;
sync (); sync();
*addr = ~cnt; *addr = ~cnt;
} }
addr = base; addr = base;
sync (); sync();
save[i] = *addr; save[i] = *addr;
sync (); sync();
*addr = 0; *addr = 0;
sync (); sync();
if ((val = *addr) != 0) { if ((val = *addr) != 0) {
/* Restore the original data before leaving the function. /* Restore the original data before leaving the function. */
*/ sync();
sync ();
*addr = save[i]; *addr = save[i];
for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) { for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) {
addr = base + cnt; addr = base + cnt;
sync (); sync();
*addr = save[--i]; *addr = save[--i];
} }
return (0); return (0);
} }
for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) { for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) {
addr = base + cnt; /* pointer arith! */ addr = base + cnt; /* pointer arith! */
val = *addr; val = *addr;
*addr = save[--i]; *addr = save[--i];
if (val != ~cnt) { if (val != ~cnt) {
size = cnt * sizeof (long); size = cnt * sizeof(long);
/* Restore the original data before leaving the function. /*
* Restore the original data
* before leaving the function.
*/ */
for (cnt <<= 1; cnt < maxsize / sizeof (long); cnt <<= 1) { for (cnt <<= 1;
cnt < maxsize / sizeof(long);
cnt <<= 1) {
addr = base + cnt; addr = base + cnt;
*addr = save[--i]; *addr = save[--i];
} }

Loading…
Cancel
Save