pinctrl: tegra: print better error messages
authorStephen Warren <swarren@nvidia.com>
Mon, 14 Apr 2014 21:33:42 +0000 (15:33 -0600)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 22 Apr 2014 14:53:43 +0000 (16:53 +0200)
When an attempt is made to configure an unsupported option on a pin,
print the DT property name of that option, so it's easier to debug
what the problem is.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-tegra.c

index 0faa09200781a6fbd3108cfb04b2744696d9242d..2d43bff74f59bd98d33cb61f4d456849b6718f1c 100644 (file)
@@ -413,10 +413,21 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx,
        }
 
        if (*reg < 0 || *bit > 31) {
-               if (report_err)
+               if (report_err) {
+                       const char *prop = "unknown";
+                       int i;
+
+                       for (i = 0; i < ARRAY_SIZE(cfg_params); i++) {
+                               if (cfg_params[i].param == param) {
+                                       prop = cfg_params[i].property;
+                                       break;
+                               }
+                       }
+
                        dev_err(pmx->dev,
-                               "Config param %04x not supported on group %s\n",
-                               param, g->name);
+                               "Config param %04x (%s) not supported on group %s\n",
+                               param, prop, g->name);
+               }
                return -ENOTSUPP;
        }