lkml.org 
[lkml]   [2015]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC/PATCHv1 1/2] clk: of: helper for filling parent clock array and return num of parents
From
On Mon, Jun 1, 2015 at 11:46 PM,  <dinguyen@opensource.altera.com> wrote:
> --- 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);
>
> +/*
> + * of_clk_parent_fill(): Helper clock function that will fill the parent
> + * clock's array and return the number of parents it found.
> + * @np: Device node pointer associated with clock provider
> + * @parents: pointer to char array that hold the parent's name
> + * @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, int size)

I'd say "unsigned int size", but of_clk_get_parent_name(),
of_parse_phandle_with_args(), and of_property_read_string_index() also take
"int" :-(

> +{
> + int i = 0;

If "size" becomes "unsigned int", "i" should be "unsigned int", too.

> +
> + while (i < size && (parents[i] = of_clk_get_parent_name(np, i)) != NULL)
> + i++;
> +
> + return i;

Return type "int" is OK, though...

> +}

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


\
 
 \ /
  Last update: 2015-06-02 09:41    [W:0.043 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site