From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 1/2] arm/cpu/start.c: Distil some common code in __start().
Date: Fri, 30 Oct 2015 08:20:07 +0100 [thread overview]
Message-ID: <20151030072007.GY25308@pengutronix.de> (raw)
In-Reply-To: <1446057278-20538-2-git-send-email-andrew.smirnov@gmail.com>
On Wed, Oct 28, 2015 at 11:34:37AM -0700, Andrey Smirnov wrote:
> Both barebox_boarddata and barebox_boot_dtb perform essentially the
> same function -- hold a pointer to a chunk of private data. Since only
> one variable is ever used at any given time we may as well merge those
> two variable into one. This also allows us to share more code between
> two boot paths (board data vs. device tree)
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>
> Changes since v1:
> - Unified barebox_boarddata and barebox_boot_dtb into
> barebox_private_data which allowed to simplify distilled code
> and avoid using double star pointers
>
>
> arch/arm/cpu/start.c | 58 +++++++++++++++++++++++++++++++++-------------------
> 1 file changed, 37 insertions(+), 21 deletions(-)
>
> diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
> index 8e5097b..066dad8 100644
> --- a/arch/arm/cpu/start.c
> +++ b/arch/arm/cpu/start.c
> @@ -32,25 +32,35 @@
> #include "mmu-early.h"
>
> unsigned long arm_stack_top;
> -static void *barebox_boarddata;
> +static void *barebox_private_data;
>
> u32 barebox_arm_machine(void)
> {
> struct barebox_arm_boarddata *bd;
>
> - if (!barebox_boarddata)
> + if (!barebox_private_data)
> return 0;
>
> - bd = barebox_boarddata;
> + bd = barebox_private_data;
>
> return bd->machine;
> }
>
> -static void *barebox_boot_dtb;
> -
> void *barebox_arm_boot_dtb(void)
> {
> - return barebox_boot_dtb;
> + return barebox_private_data;
> +}
Previously we knew that the pointer barebox_arm_machine() works on is a
machine type entry and we knew that the pointer returned from
barebox_arm_boot_dtb() is a dtb. With this patch both are share the same
pointer so we would have to check if the result returned from
barebox_arm_boot_dtb() is actually a dtb. That's not so nice.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-10-30 7:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-28 18:34 [PATCH v2] ARM: Add support for semihosting Andrey Smirnov
2015-10-28 18:34 ` [PATCH v2 1/2] arm/cpu/start.c: Distil some common code in __start() Andrey Smirnov
2015-10-30 7:20 ` Sascha Hauer [this message]
2015-10-30 16:16 ` Andrey Smirnov
2015-10-28 18:34 ` [PATCH v2 2/2] arm/cpu: Avoid multiple definitions of barebox_arm_entry Andrey Smirnov
2015-10-30 7:10 ` [PATCH v2] ARM: Add support for semihosting 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=20151030072007.GY25308@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=andrew.smirnov@gmail.com \
--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