diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-06-06 08:24:22 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-06-15 08:33:20 +0200 |
commit | 6ce1d45f8f9c3b26d1730e387302be8e14517bde (patch) | |
tree | c4d20ed63bf025b27986539bd8a8cbc74f6a5cee /arch/ppc | |
parent | 92950a4b1e7d465365211239385444fc18cd4a1b (diff) | |
download | barebox-6ce1d45f8f9c3b26d1730e387302be8e14517bde.tar.gz barebox-6ce1d45f8f9c3b26d1730e387302be8e14517bde.tar.xz |
ppc: bootm: rename variables
In bootm_relocate_fdt 'addr' is used for two different purposes, once for the
os address and once for the new fdt. Make the code more readable by
using two variables describing their meaning, 'os' and 'newfdt'.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/ppc')
-rw-r--r-- | arch/ppc/lib/ppclinux.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c index 3fca6b2720..ed2f769c25 100644 --- a/arch/ppc/lib/ppclinux.c +++ b/arch/ppc/lib/ppclinux.c @@ -14,34 +14,36 @@ #include <restart.h> #include <fs.h> -static int bootm_relocate_fdt(void *addr, struct image_data *data) +static int bootm_relocate_fdt(void *os, struct image_data *data) { - if (addr < LINUX_TLB1_MAX_ADDR) { + void *newfdt; + + if (os < LINUX_TLB1_MAX_ADDR) { /* The kernel is within the boot TLB mapping. * Put the DTB above if there is no space * below. */ - if (addr < (void *)data->oftree->totalsize) { - addr = (void *)PAGE_ALIGN((phys_addr_t)addr + + if (os < (void *)data->oftree->totalsize) { + os = (void *)PAGE_ALIGN((phys_addr_t)os + data->os->header.ih_size); - addr += data->oftree->totalsize; - if (addr < LINUX_TLB1_MAX_ADDR) - addr = LINUX_TLB1_MAX_ADDR; + os += data->oftree->totalsize; + if (os < LINUX_TLB1_MAX_ADDR) + os = LINUX_TLB1_MAX_ADDR; } } - if (addr > LINUX_TLB1_MAX_ADDR) { + if (os > LINUX_TLB1_MAX_ADDR) { pr_crit("Unable to relocate DTB to Linux TLB\n"); return 1; } - addr = (void *)PAGE_ALIGN_DOWN((phys_addr_t)addr - + newfdt = (void *)PAGE_ALIGN_DOWN((phys_addr_t)os - data->oftree->totalsize); - memcpy(addr, data->oftree, data->oftree->totalsize); + memcpy(newfdt, data->oftree, data->oftree->totalsize); free(data->oftree); - data->oftree = addr; + data->oftree = newfdt; - pr_info("Relocating device tree to 0x%p\n", addr); + pr_info("Relocating device tree to 0x%p\n", newfdt); return 0; } |