aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-03-01 20:48:33 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-03-02 10:20:54 -0500
commit110e4ec5a1cfe20190e7f8c2b8b4eef369de3c99 (patch)
tree2e20b44478f47069ac19f0ef9f5a92bee7576bdd /drivers/pinctrl
parent46919ae63d4820e76724beb655274ce143f0da0b (diff)
pinctrl: assume map table entries can't have a NULL name field
pinctrl_register_mappings() already requires that every mapping table entry have a non-NULL name field. Logically, this makes sense too; drivers should always request a specific named state so they know what they're getting. Relying on getting the first mentioned state in the mapping table is error-prone, and a nasty special case to implement, given that a given the mapping table may define multiple states for a device. Remove a small part of the documentation that talked about optionally requesting a specific state; it's mandatory now. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Dong Aisheng <dong.aisheng@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/core.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index f25307b0e00a..6af6d8d117df 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -461,8 +461,8 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name)
461 int i; 461 int i;
462 struct pinctrl_map const *map; 462 struct pinctrl_map const *map;
463 463
464 /* We must have a dev name */ 464 /* We must have both a dev and state name */
465 if (WARN_ON(!dev)) 465 if (WARN_ON(!dev || !name))
466 return ERR_PTR(-EINVAL); 466 return ERR_PTR(-EINVAL);
467 467
468 devname = dev_name(dev); 468 devname = dev_name(dev);
@@ -504,16 +504,9 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name)
504 if (strcmp(map->dev_name, devname)) 504 if (strcmp(map->dev_name, devname))
505 continue; 505 continue;
506 506
507 /* 507 /* State name must be the one we're looking for */
508 * If we're looking for a specific named map, this must match, 508 if (strcmp(map->name, name))
509 * else we loop and look for the next. 509 continue;
510 */
511 if (name != NULL) {
512 if (map->name == NULL)
513 continue;
514 if (strcmp(map->name, name))
515 continue;
516 }
517 510
518 ret = pinmux_apply_muxmap(pctldev, p, dev, devname, map); 511 ret = pinmux_apply_muxmap(pctldev, p, dev, devname, map);
519 if (ret) { 512 if (ret) {