From: Mitch Bradley <wmb@firmworks.com>
To: Mitch Bradley <wmb@firmworks.com>,
linuxppc-dev@ozlabs.org, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] Support NAND partitions >4GiB with Open Firmware
Date: Thu, 26 Jun 2008 17:48:01 -1000 [thread overview]
Message-ID: <486462F1.9080602@firmworks.com> (raw)
In-Reply-To: <20080627033817.GJ17621@yookeroo.seuss>
David Gibson wrote:
> On Thu, Jun 26, 2008 at 05:28:42PM -1000, Mitch Bradley wrote:
>
>> David Gibson wrote:
>>
>>> On Thu, Jun 26, 2008 at 01:50:40PM -1000, Mitch Bradley wrote:
>>>
> [snip]
>
>>>> + const u_int32_t *propval;
>>>> + u_int32_t addrcells = 0, sizecells = 0;
>>>> int len;
>>>>
>>>> - reg = of_get_property(pp, "reg", &len);
>>>> - if (!reg || (len != 2 * sizeof(u32))) {
>>>> + /*
>>>> + * Determine the layout of a "reg" entry based on the parent
>>>> + * node's properties, if it hasn't been done already.
>>>> + */
>>>> +
>>>> + if (addrcells == 0)
>>>>
>>>>
>>> Redundant 'if'; you've just initialized this variable to zero.
>>>
>> The intention is that the body of the "if" should only be executed
>> once during the loop, since the parent node is the same for all
>> children.
>>
>
> But the initialization is within the loop body as well, so this won't
> do it. Just factor the code getting addr and size cells right out of
> the loop, instead.
>
>
Hmmm. Perhaps it's better to move the declaration of the variables out of
the loop instead.
Moving the of_n_*_cells() calls outside the loop requires redundant calls
to of_get_child() and of_node_put(), because of_n_*_cells() implicitly
reach up to the parent node. That is almost certainly more expensive
than the "if".
next prev parent reply other threads:[~2008-06-27 3:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-26 23:50 [PATCH] Support NAND partitions >4GiB with Open Firmware Mitch Bradley
2008-06-27 3:09 ` Mitch Bradley
2008-06-27 3:20 ` David Gibson
2008-06-27 3:28 ` Mitch Bradley
2008-06-27 3:38 ` David Gibson
2008-06-27 3:48 ` Mitch Bradley [this message]
2008-06-27 4:04 ` David Gibson
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=486462F1.9080602@firmworks.com \
--to=wmb@firmworks.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linuxppc-dev@ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox