mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/6] ppc: bootm: rename variables
Date: Wed,  6 Jun 2018 09:11:25 +0200	[thread overview]
Message-ID: <20180606071129.28884-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20180606071129.28884-1-s.hauer@pengutronix.de>

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>
---
 arch/ppc/lib/ppclinux.c | 26 ++++++++++++++------------
 1 file 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;
 }
 
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-06-06  7:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06  7:11 [PATCH 0/6] bootm: split bootm_load_devicetree into two functions Sascha Hauer
2018-06-06  7:11 ` [PATCH 1/6] ARM: bootm: drop usage of data->oftree Sascha Hauer
2018-06-06  7:11 ` Sascha Hauer [this message]
2018-06-06  7:11 ` [PATCH 3/6] ppc: bootm: remove unnecessary parameter Sascha Hauer
2018-06-06  7:11 ` [PATCH 4/6] ppc: bootm: Drop usage of data->oftree Sascha Hauer
2018-06-06  7:11 ` [PATCH 5/6] bootm: Drop data->oftree Sascha Hauer
2018-06-06  7:11 ` [PATCH 6/6] bootm: Split bootm_load_devicetree into two functions Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180606071129.28884-3-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox