All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Ayush Singh <ayush@beagleboard.org>
Cc: Andreas Gnau <andreas.gnau@iopsys.eu>,
	d-gole@ti.com, lorforlinux@beagleboard.org,
	jkridner@beagleboard.org, robertcnelson@beagleboard.org,
	Andrew Davis <afd@ti.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Simon Glass <sjg@chromium.org>,
	devicetree-compiler@vger.kernel.org
Subject: Re: [PATCH v3 2/4] dtc: Add data_insert_data function
Date: Thu, 12 Jun 2025 20:56:03 +1000	[thread overview]
Message-ID: <aEqyQ1scjqvq1NVF@zatzit> (raw)
In-Reply-To: <20250605-previous-value-v3-2-0983d0733a07@beagleboard.org>

[-- Attachment #1: Type: text/plain, Size: 2155 bytes --]

On Thu, Jun 05, 2025 at 04:18:07PM +0530, Ayush Singh wrote:
> Add helper function to insert a data struct into another.

Applied, thanks.

> 
> Signed-off-by: Ayush Singh <ayush@beagleboard.org>
> ---
>  data.c | 27 +++++++++++++++++++++++++++
>  dtc.h  |  1 +
>  2 files changed, 28 insertions(+)
> 
> diff --git a/data.c b/data.c
> index 913796f2e664d07cdc48e0cbf2ab5d6fe9978072..5b25aa060416134be430aebe33c9cce49515297f 100644
> --- a/data.c
> +++ b/data.c
> @@ -251,6 +251,33 @@ bool data_is_one_string(struct data d)
>  	return true;
>  }
>  
> +struct data data_insert_data(struct data d, struct marker *m, struct data old)
> +{
> +	unsigned int offset = m->offset;
> +	struct marker *next = m->next;
> +	struct marker *marker;
> +	struct data new_data;
> +	char *ref;
> +
> +	new_data = data_insert_at_marker(d, m, old.val, old.len);
> +
> +	/* Copy all markers from old value */
> +	marker = old.markers;
> +	for_each_marker(marker) {
> +		ref = NULL;
> +
> +		if (marker->ref)
> +			ref = xstrdup(marker->ref);
> +
> +		m->next = alloc_marker(marker->offset + offset, marker->type,
> +				       ref);
> +		m = m->next;
> +	}
> +	m->next = next;
> +
> +	return new_data;
> +}
> +
>  struct marker *alloc_marker(unsigned int offset, enum markertype type,
>  			    char *ref)
>  {
> diff --git a/dtc.h b/dtc.h
> index bd803397449a4b71ff89944ea125cefb96c4dd21..3a220b9afc99f92ea57d50d348eb0872bc779818 100644
> --- a/dtc.h
> +++ b/dtc.h
> @@ -182,6 +182,7 @@ struct data data_append_addr(struct data d, uint64_t addr);
>  struct data data_append_byte(struct data d, uint8_t byte);
>  struct data data_append_zeroes(struct data d, int len);
>  struct data data_append_align(struct data d, int align);
> +struct data data_insert_data(struct data d, struct marker *m, struct data old);
>  
>  struct marker *alloc_marker(unsigned int offset, enum markertype type,
>  			    char *ref);
> 

-- 
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 --]

  reply	other threads:[~2025-06-12 10:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 10:48 [PATCH v3 0/4] Add capability to create property from old property Ayush Singh
2025-06-05 10:48 ` [PATCH v3 1/4] srcpos: Define srcpos_free Ayush Singh
2025-06-09 12:39   ` David Gibson
2025-06-05 10:48 ` [PATCH v3 2/4] dtc: Add data_insert_data function Ayush Singh
2025-06-12 10:56   ` David Gibson [this message]
2025-06-05 10:48 ` [PATCH v3 3/4] dtc: Add /./ Ayush Singh
2025-06-05 10:48 ` [PATCH v3 4/4] tests: Add test for /./ Ayush Singh

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=aEqyQ1scjqvq1NVF@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=afd@ti.com \
    --cc=andreas.gnau@iopsys.eu \
    --cc=ayush@beagleboard.org \
    --cc=d-gole@ti.com \
    --cc=devicetree-compiler@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=jkridner@beagleboard.org \
    --cc=lorforlinux@beagleboard.org \
    --cc=robertcnelson@beagleboard.org \
    --cc=sjg@chromium.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 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.