From: David Gibson <david@gibson.dropbear.id.au>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: devicetree-compiler@vger.kernel.org
Subject: Re: [PATCH v2 1/2] livetree: Simplify append_to_property()
Date: Sat, 16 Aug 2025 14:46:55 +1000 [thread overview]
Message-ID: <aKANP68-2mO_RmZu@zatzit> (raw)
In-Reply-To: <eef88e559f5b9818c4c2311fa8a75ab6fd4508d5.1755264521.git.u.kleine-koenig@baylibre.com>
[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]
On Fri, Aug 15, 2025 at 03:34:53PM +0200, Uwe Kleine-König wrote:
> The two if branches are quite similar. Build the property first (in case
> it doesn't exist) and then the common parts can be done outside the if
> block.
The patch looks good, but I'll need a Signed-off-by line.
> ---
> livetree.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/livetree.c b/livetree.c
> index d51d05830b18..6127d604d528 100644
> --- a/livetree.c
> +++ b/livetree.c
> @@ -340,20 +340,16 @@ void append_to_property(struct node *node,
> char *name, const void *data, int len,
> enum markertype type)
> {
> - struct data d;
> struct property *p;
>
> p = get_property(node, name);
> - if (p) {
> - d = data_add_marker(p->val, type, name);
> - d = data_append_data(d, data, len);
> - p->val = d;
> - } else {
> - d = data_add_marker(empty_data, type, name);
> - d = data_append_data(d, data, len);
> - p = build_property(name, d, NULL);
> + if (!p) {
> + p = build_property(name, empty_data, NULL);
> add_property(node, p);
> }
> +
> + p->val = data_add_marker(p->val, type, name);
> + p->val = data_append_data(p->val, data, len);
> }
>
> struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size)
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-08-16 4:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 13:34 [PATCH v2 0/2] livetree: Add only new data to fixup nodes instead of complete regeneration Uwe Kleine-König
2025-08-15 13:34 ` [PATCH v2 1/2] livetree: Simplify append_to_property() Uwe Kleine-König
2025-08-16 4:46 ` David Gibson [this message]
2025-08-15 13:34 ` [PATCH v2 2/2] livetree: Add only new data to fixup nodes instead of complete regeneration Uwe Kleine-König
2025-08-16 4:54 ` David Gibson
2025-08-17 10:40 ` Uwe Kleine-König
2025-08-18 3:06 ` David Gibson
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=aKANP68-2mO_RmZu@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=devicetree-compiler@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.