[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20131121155649.48C96C406A3@trevor.secretlab.ca>
Date: Thu, 21 Nov 2013 15:56:49 +0000
From: Grant Likely <grant.likely@...aro.org>
To: Hiroshi Doyu <hdoyu@...dia.com>
Cc: Stephen Warren <swarren@...dia.com>,
"will.deacon@....com" <will.deacon@....com>,
"thierry.reding@...il.com" <thierry.reding@...il.com>,
"swarren@...dotorg.org" <swarren@...dotorg.org>,
"galak@...eaurora.org" <galak@...eaurora.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"lorenzo.pieralisi@....com" <lorenzo.pieralisi@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv5 1/9] of: introduce of_property_for_earch_phandle_with_args()
On Thu, 21 Nov 2013 15:12:18 +0200, Hiroshi Doyu <hdoyu@...dia.com> wrote:
> On Thu, 21 Nov 2013 13:43:28 +0100
> Grant Likely <grant.likely@...aro.org> wrote:
>
> > On Tue, 19 Nov 2013 11:33:05 +0200, Hiroshi Doyu <hdoyu@...dia.com> wrote:
> > > The following pattern of code is tempting:
> > >
> > > for (i = 0; !of_parse_phandle_with_args(np, list, cells, i, args); i++)
> > >
> > > Signed-off-by: Hiroshi Doyu <hdoyu@...dia.com>
> >
> > That's a very minimal commit message. Can you elaborate please.
>
> The above can be:
>
> "
> The following pattern of code is tempting to add a new member for
> of_property_for_each_*() family as an idiom.
>
> for (i = 0;
> !of_parse_phandle_with_args(np, list, cells, i, args); i++)
> <do something with "args">;
> "
I really do like commit messages to be full enough that a future reader
can figure out why a patch was written. ie:
"Iterating over a property containing a list of phandles with
arguments is a common operation for device drivers. This patch
adds a new of_property_for_each_phandle_with_args() macro to
make the iteration simpler."
g.
>
> Actual usage is here:
>
> int i;
> struct of_phandle_args args;
>
> of_property_for_each_phandle_with_args(dev->of_node, "iommus",
> "#iommu-cells", i, &args) {
> pr_debug("%s(i=%d) %s\n", __func__, i, dev_name(dev));
>
> if (!of_find_iommu_by_node(args.np))
> return -EPROBE_DEFER;
>
> Is this acceptable?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists