linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>,
	linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Li Yang <leoli@freescale.com>, Timur Tabi <timur@freescale.com>
Subject: Re: [PATCH 1/2] OF: new helper: of_parse_phandles_with_args()
Date: Fri, 10 Oct 2008 14:37:29 +1100	[thread overview]
Message-ID: <1223609849.8157.135.camel@pasglop> (raw)
In-Reply-To: <20080925183710.GA25627@oksana.dev.rtsoft.ru>


> +	for (i = 0; i < list_cells; cur_index++) {
> +		const u32 *cells;
> +		const phandle *phandle;
> +
> +		phandle = list + i;
> +		args = phandle + 1;

Rather than incrementing i, I would just use a running pointer "list"
and drop "i" totally. Not big deal tho.

> +		/* one cell hole in the list = <>; */
> +		if (!*phandle) {
> +			if (cur_index == index)
> +				return -ENOENT;
> +			i++;
> +			continue;
> +		}

I don't totally understand the above. The 0 phandle terminates the list
or is just an empty slot in it ? In the later case, it might be more
readable to use goto to skip over down to the normal if (cur_index ==
index) break; and let it return via the normal if (!node) return -ENOENT
out of the loop.

Appart from that it's good and I'm fine with putting it in if you respin
despite being a bit late mostly because it's me who is later reviewing
there :-)

Cheers,
Ben.

  reply	other threads:[~2008-10-10  3:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 18:36 [RFC PATCH 0/2] QE Pin Multiplexing API Anton Vorontsov
2008-09-25 18:37 ` [PATCH 1/2] OF: new helper: of_parse_phandles_with_args() Anton Vorontsov
2008-10-10  3:37   ` Benjamin Herrenschmidt [this message]
2008-10-10 14:43     ` [PATCH 1/2 v2] " Anton Vorontsov
2008-10-12 23:31       ` Benjamin Herrenschmidt
2008-09-25 18:37 ` [PATCH 2/2] powerpc/QE: implement QE Pin Multiplexing API Anton Vorontsov
  -- strict thread matches above, loose matches on Subject: below --
2008-10-06 16:48 [PATCH 0/2] QE pin multiplexing API Anton Vorontsov
2008-10-06 16:48 ` [PATCH 1/2] OF: new helper: of_parse_phandles_with_args() Anton Vorontsov

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=1223609849.8157.135.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=akpm@linux-foundation.org \
    --cc=avorontsov@ru.mvista.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=leoli@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=timur@freescale.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 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).