All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] libfdt: introduce function fdt_get_max_phandle
Date: Wed, 26 May 2010 22:17:36 +0200	[thread overview]
Message-ID: <20100526201736.07107EAC238@gemini.denx.de> (raw)
In-Reply-To: <1274308618-2974-1-git-send-email-timur@freescale.com>

Dear Timur Tabi,

In message <1274308618-2974-1-git-send-email-timur@freescale.com> you wrote:
> Introduce function fdt_get_max_phandle(), which returns the largest value
> of all phandles in a device tree.  This is useful for allocating a new phandle
> property, since all phandles must be unique.
> 
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>  include/libfdt.h    |   20 ++++++++++++++++++++
>  lib/libfdt/fdt_ro.c |   17 +++++++++++++++++
>  2 files changed, 37 insertions(+), 0 deletions(-)

Please submit as part of a patch / patch series that acrtually uses
this feature.  As is, it's just dead code that has no users.

> +int fdt_get_max_phandle(const void *fdt)
> +{
> +	int offset;
> +	uint32_t temp, phandle = 0;
> +
> +	FDT_CHECK_HEADER(fdt);
> +
> +	for (offset = fdt_next_node(fdt, -1, NULL); offset >= 0;
> +	     offset = fdt_next_node(fdt, offset, NULL)) {
> +		temp = fdt_get_phandle(fdt, offset);
> +		if (temp > phandle)
> +			phandle = temp;
> +	}
> +
> +	return phandle;
> +}

As fdt_get_phandle() returns a uint32_t, fdt_get_max_phandle() should
return the same type, not int.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Star Trek Lives!

  reply	other threads:[~2010-05-26 20:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 22:36 [U-Boot] [PATCH] libfdt: introduce function fdt_get_max_phandle Timur Tabi
2010-05-26 20:17 ` Wolfgang Denk [this message]
2010-05-27  2:38   ` Jerry Van Baren
2010-07-10 13:27     ` Kumar Gala

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=20100526201736.07107EAC238@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.