Re: [RFC/PATCHv1 1/2] clk: of: helper for filling parent clock array and return num of parents

From: Geert Uytterhoeven
Date: Tue Jun 02 2015 - 03:17:15 EST


On Mon, Jun 1, 2015 at 11:46 PM, <dinguyen@xxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/