linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: michael@ellerman.id.au
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 01/16] Add of_get_next_parent()
Date: Fri, 26 Oct 2007 03:38:03 -0700 (PDT)	[thread overview]
Message-ID: <20071026.033803.74739006.davem@davemloft.net> (raw)
In-Reply-To: <80449d4682309dbf8cf80816be4f381fe875f3d1.1193381582.git.michael@ellerman.id.au>

From: Michael Ellerman <michael@ellerman.id.au>
Date: Fri, 26 Oct 2007 16:54:31 +1000 (EST)

> Iterating through a device node's parents is simple enough, but dealing
> with the refcounts properly is a little ugly, and replicating that logic
> is asking for someone to get it wrong or forget it all together, eg:
> 
> while (dn != NULL) {
> 	/* loop body */
> 	tmp = of_get_parent(dn);
> 	of_node_put(dn);
> 	dn = tmp;
> }
> 
> So add of_get_next_parent(), inspired by of_get_next_child(). The contract
> is that it returns the parent and drops the reference on the current node,
> this makes the loop look like:
> 
> while (dn != NULL) {
> 	/* loop body */
> 	dn = of_get_next_parent(dn);
> }
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Looks good to me:

Acked-by: David S. Miller <davem@davemloft.net>

      parent reply	other threads:[~2007-10-26 10:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26  6:54 [PATCH 01/16] Add of_get_next_parent() Michael Ellerman
2007-10-26  6:54 ` [PATCH 02/16] Use of_get_next_parent() in pci_dma_bus_setup_pSeries() Michael Ellerman
2007-10-26  6:54 ` [PATCH 03/16] Use of_get_next_parent() in pci_dma_bus_setup_pSeriesLP() Michael Ellerman
2007-10-26  6:54 ` [PATCH 04/16] Use of_get_next_parent() in pci_dma_dev_setup_pSeries() Michael Ellerman
2007-10-26  6:54 ` [PATCH 05/16] Use of_get_next_parent() in pci_dma_dev_setup_pSeriesLP() Michael Ellerman
2007-10-26  6:54 ` [PATCH 06/16] Use of_get_next_child() in pci_dma_bus_setup_pSeries() Michael Ellerman
2007-10-26  6:54 ` [PATCH 07/16] Use of_get_next_parent() in xics_setup_8259_cascade() Michael Ellerman
2007-10-26  6:54 ` [PATCH 08/16] Use of_get_next_parent() in pseries_mpic_init_IRQ() Michael Ellerman
2007-10-26  6:54 ` [PATCH 09/16] Use of_get_next_parent() in axon_msi.c Michael Ellerman
2007-10-26  7:24   ` Stephen Rothwell
2007-10-26  6:54 ` [PATCH 10/16] Use of_get_next_child() in EEH gather_pci_data() Michael Ellerman
2007-10-26  6:54 ` [PATCH 11/16] Use of_get_next_child() in eeh_restore_bars() Michael Ellerman
2007-10-26  7:29   ` Stephen Rothwell
2007-10-29  3:46     ` Michael Ellerman
2007-11-05 19:23       ` Linas Vepstas
2007-10-26  6:54 ` [PATCH 12/16] Use of_get_next_child() in eeh_add_device_tree_early() Michael Ellerman
2007-10-26  6:54 ` [PATCH 13/16] Use of_get_next_child() in __eeh_mark_slot() Michael Ellerman
2007-10-26  6:54 ` [PATCH 14/16] Use of_get_next_child() in __eeh_clear_slot() Michael Ellerman
2007-10-26  6:54 ` [PATCH 15/16] Use of_get_next_child() in eeh_reset_device() Michael Ellerman
2007-10-26  6:54 ` [PATCH 16/16] Use of_get_next_child() in EEH print_device_node_tree() Michael Ellerman
2007-10-26 10:38 ` David Miller [this message]

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=20071026.033803.74739006.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    /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;
as well as URLs for NNTP newsgroup(s).