Re: [PATCH 3/4] pinctrl: add a generic way to map node to map for group based drivers

From: Linus Walleij
Date: Tue Oct 28 2014 - 11:40:46 EST


On Mon, Oct 20, 2014 at 10:04 AM, Antoine Tenart
<antoine.tenart@xxxxxxxxxxxxxxxxxx> wrote:

> This patch add a generic function to use a standard callback to
> .dt_node_to_map for group based pinctrl drivers.
>
> It parses nodes of the form:
>
> foo_pmux: foo-pmux {
> function = "foo";
> groups = "g0", "g1", "g2";
> }
>
> Signed-off-by: Antoine Tenart <antoine.tenart@xxxxxxxxxxxxxxxxxx>

Really nice! :)

> +int pinconf_generic_function_groups_dt_node_to_map(struct pinctrl_dev *pctldev,
> + struct device_node *node, struct pinctrl_map **map,
> + unsigned *num_maps)
> +{
> + struct property *prop;
> + unsigned reserved_maps = 0;
> + const char *function_name, *group_name;
> + int ngroups, ret;
> +
> + *map = NULL;
> + *num_maps = 0;
> +
> + ret = of_pinctrl_utils_read_function(pctldev, node, &function_name,
> + &ngroups);
> + if (ret)
> + return ret;

So maybe you want this not to print errors as I said in the first patch.

Or add a function of_pinctrl_utils_is_mux()?

> + ret = pinctrl_utils_reserve_map(pctldev, map, &reserved_maps, num_maps,
> + ngroups);
> + if (ret)
> + return ret;
> +
> + of_pinctrl_for_each_function_group(node, prop, group_name) {
> + ret = pinctrl_utils_add_map_mux(pctldev, map, &reserved_maps,
> + num_maps, group_name,
> + function_name);
> + if (ret) {
> + dev_err(pctldev->dev, "cannot add map: %d\n", ret);
> + return ret;
> + }
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(pinconf_generic_function_groups_dt_node_to_map);

The rest looks really good.

Yours,
Linus Walleij
--
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/