From: Dinh Nguyen <dinguyen@opensource.altera.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: <mturquette@linaro.org>, <dinh.linux@gmail.com>,
<geert@linux-m68k.org>, <linux-clk@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [RFC/PATCHv2 1/2] clk: of: helper for filling parent clock array and return num of parents
Date: Fri, 5 Jun 2015 10:35:40 -0500 [thread overview]
Message-ID: <5571C1CC.7060404@opensource.altera.com> (raw)
In-Reply-To: <20150604212447.GP676@codeaurora.org>
On 6/4/15 4:24 PM, Stephen Boyd wrote:
> On 06/04, dinguyen@opensource.altera.com wrote:
>> From: Dinh Nguyen <dinguyen@opensource.altera.com>
>>
>> Sprinkled all through the platform clock drivers are code like this to
>> fill the clock parent array:
>>
>> for (i = 0; i < num_parents; ++i)
>> parent_names[i] = of_clk_get_parent_name(np, i);
>>
>> The of_clk_parent_fill() will do the same as the code above, and while
>> at it, return the number of parents as well since the logic of the
>> function is to the walk the clock node to look for the parent.
>>
>> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
>> ---
>> v2: use unsigned int for size
>> ---
>> drivers/clk/clk.c | 20 ++++++++++++++++++++
>> include/linux/clk-provider.h | 1 +
>> 2 files changed, 21 insertions(+)
>>
>> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>> index 459ce9d..778bebd 100644
>> --- a/drivers/clk/clk.c
>> +++ b/drivers/clk/clk.c
>> @@ -3060,6 +3060,26 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
>> }
>> EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
>>
>> +/*
>
> Need a double ** here for kernel doc.
>
Ok...
>> + * of_clk_parent_fill(): Helper clock function that will fill the parent
>> + * clock's array and return the number of parents it found.
>
> Please try to shorten this sentence.
>
> Fill @parents with names of @np's parents and return number of parents
>
>> + * @np: Device node pointer associated with clock provider
>> + * @parents: pointer to char array that hold the parent's name
>
> s/parent's name/parents' names/ ?
>
Will address in v3.
>> + * @size: size of the parents array
>> + *
>> + * Returns number of parents for the clock node.
>> + */
>> +int of_clk_parent_fill(struct device_node *np, const char **parents, unsigned int size)
>> +{
>> + unsigned int i = 0;
>> +
>> + while (i < size && (parents[i] = of_clk_get_parent_name(np, i)) != NULL)
>> + i++;
>> +
>> + return i;
>> +}
>> +EXPORT_SYMBOL(of_clk_parent_fill);
>
> Can this be GPL?
>
Yes.
Thanks,
Dinh
next prev parent reply other threads:[~2015-06-05 15:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 19:12 [RFC/PATCHv2 0/2] clk: of: add helper function to fill parent clock array dinguyen
2015-06-04 19:12 ` [RFC/PATCHv2 1/2] clk: of: helper for filling parent clock array and return num of parents dinguyen
2015-06-04 21:24 ` Stephen Boyd
2015-06-05 15:35 ` Dinh Nguyen [this message]
2015-06-04 19:12 ` [RFC/PATCHv2 2/2] clk: socfpga: make use of of_clk_parent_fill helper function dinguyen
2015-06-04 21:25 ` Stephen Boyd
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=5571C1CC.7060404@opensource.altera.com \
--to=dinguyen@opensource.altera.com \
--cc=dinh.linux@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=sboyd@codeaurora.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;
as well as URLs for NNTP newsgroup(s).