aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2014-10-21 05:40:45 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-10-30 10:52:39 -0400
commitfdaaf6d6609b0ddb65cd3211cc7ceb892d7a2550 (patch)
treeb97f86dae72a112c96707ff8f1a15b944c22da8b /drivers/pinctrl
parentcbd1b6529f07308bc4921a088b0f83895e403109 (diff)
pinctrl: mxs: warn if functions are not grouped by name
The mxs pinctrl driver cannot handle when functions are not grouped by name (which IMO is a bug). This happens for example if a imx28-somemachine.dts provides a function that has the same name as a function defined in imx28.dtsi. The proper way to fix that would be to check for duplicates in the loops (which increases parsing time) or parse the groups first and sort the resulting array. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/freescale/pinctrl-mxs.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index f98c6bb0f769..646d5c244af1 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -445,6 +445,31 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
445 if (of_property_read_u32(child, "reg", &val)) 445 if (of_property_read_u32(child, "reg", &val))
446 continue; 446 continue;
447 if (strcmp(fn, child->name)) { 447 if (strcmp(fn, child->name)) {
448 struct device_node *child2;
449
450 /*
451 * This reference is dropped by
452 * of_get_next_child(np, * child)
453 */
454 of_node_get(child);
455
456 /*
457 * The logic parsing the functions from dt currently
458 * doesn't handle if functions with the same name are
459 * not grouped together. Only the first contiguous
460 * cluster is usable for each function name. This is a
461 * bug that is not trivial to fix, but at least warn
462 * about it.
463 */
464 for (child2 = of_get_next_child(np, child);
465 child2 != NULL;
466 child2 = of_get_next_child(np, child2)) {
467 if (!strcmp(child2->name, fn))
468 dev_warn(&pdev->dev,
469 "function nodes must be grouped by name (failed for: %s)",
470 fn);
471 }
472
448 f = &soc->functions[idxf++]; 473 f = &soc->functions[idxf++];
449 f->name = fn = child->name; 474 f->name = fn = child->name;
450 } 475 }