All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] LIBFDT: first version of fdt_find_compatible_node
Date: Wed, 25 Apr 2007 10:58:25 +0200	[thread overview]
Message-ID: <462F1831.7070902@grandegger.com> (raw)

Hello,

attached you can find a patch implementing fdt_find_compatible_node():

/*
  * Find a node based on its device type and one of the tokens in
  * its its "compatible" property. On success, the offset of that
  * node is returned or an error code:
  *
  *   startoffset  - the node to start searching from or 0, the node
  *                  you pass will not be searched, only the next one
  *                  will; typically, you pass 0 to start the search
  *                  and then what the previous call returned.
  *   type         - the device type string to match against
  *   compat       - the string to match to one of the tokens
  *                  in the "compatible" list.
  */

It should be used as shown below:

     offset = 0;
     do {
         offset = fdt_find_compatible_node(fdt, offset, "type", "comp");
     } while (offset >= 0);

This first hack also implements a cached version as alternative, because 
tag re-scanning might take quite long. In principle, the cache could 
also be used for other functions, like fdt_path_offset(), and could be 
invalidated in case the FDT gets updated.

What do you think?

Thanks.

Wolfgang.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: u-boot-fdt-find-compatible.patch
Type: text/x-patch
Size: 6384 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070425/c8d036c1/attachment.bin 

             reply	other threads:[~2007-04-25  8:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25  8:58 Wolfgang Grandegger [this message]
2007-04-25 15:12 ` [U-Boot-Users] LIBFDT: first version of fdt_find_compatible_node Jerry Van Baren
2007-04-25 19:37   ` Wolfgang Grandegger
2007-04-25 21:06     ` Jerry Van Baren
2007-04-26  7:39       ` Wolfgang Grandegger
2007-04-26  9:42         ` Wolfgang Grandegger
2007-04-26 10:45           ` Jerry Van Baren
2007-04-26 11:12             ` Wolfgang Grandegger

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=462F1831.7070902@grandegger.com \
    --to=wg@grandegger.com \
    --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.