[PATCH v2 2/2] pinctrl: generic: improve apply_setting error verbosity

From: Matheus Castello
Date: Tue May 01 2018 - 15:34:20 EST


For generic pinconf: print the dev_error with the pinctrl vendor
driver name, error code, the sub-node property name used and the
pin that was tried to set.

Improves the undestading of the error if use a generic sub-node
property that generic-pinconf can do parse but the vendor pinctrl
driver does not support.

Signed-off-by: Matheus Castello <matheus@xxxxxxxxxxxxxxx>
---
drivers/pinctrl/pinconf.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index d3fe143..ced2b67 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -21,6 +21,7 @@
#include <linux/pinctrl/machine.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinconf.h>
+#include <linux/pinctrl/pinconf-generic.h>
#include "core.h"
#include "pinconf.h"

@@ -169,9 +170,21 @@ int pinconf_apply_setting(const struct pinctrl_setting *setting)
setting->data.configs.configs,
setting->data.configs.num_configs);
if (ret < 0) {
+#ifdef CONFIG_OF
dev_err(pctldev->dev,
- "pin_config_set op failed for pin %d\n",
+ "%s error %d setting %s for pin %d\n",
+ pctldev->desc->name, ret,
+ pinconf_generic_get_param_property_name(
+ pctldev, setting->data.configs.num_configs,
+ setting->data.configs.configs),
setting->data.configs.group_or_pin);
+#endif
+
+ dev_err(pctldev->dev,
+ "pin_config_set op failed for %s pin %d\n",
+ pctldev->desc->name,
+ setting->data.configs.group_or_pin);
+
return ret;
}
break;
--
2.7.4