* [PATCH] pinctrl: add error messages to pinmux_map_to_setting()
@ 2012-04-25 16:34 Stephen Warren
2012-04-25 18:06 ` John Crispin
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Warren @ 2012-04-25 16:34 UTC (permalink / raw)
To: Linus Walleij, John Crispin; +Cc: linux-kernel, Stephen Warren
From: Stephen Warren <swarren@nvidia.com>
pinmux_map_to_setting() detects a number of errors, but doesn't report
any specifics to the user, making debugging those errors hard.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
John, Linus,
This is mostly just FYI in case John wants to roll this into his error
reporting patch - it's all the changes I made to any non-Tegra files when
debugging my DT map data.
drivers/pinctrl/pinmux.c | 38 ++++++++++++++++++++++++++++----------
1 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index fa0357b..68cab3d 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -329,17 +329,27 @@ int pinmux_map_to_setting(struct pinctrl_map const *map,
return -EINVAL;
}
- setting->data.mux.func =
- pinmux_func_name_to_selector(pctldev, map->data.mux.function);
- if (setting->data.mux.func < 0)
- return setting->data.mux.func;
+ ret = pinmux_func_name_to_selector(pctldev, map->data.mux.function);
+ if (ret < 0) {
+ dev_err(pctldev->dev, "invalid function %s in map table\n",
+ map->data.mux.function);
+ return ret;
+ }
+ setting->data.mux.func = ret;
ret = pmxops->get_function_groups(pctldev, setting->data.mux.func,
&groups, &num_groups);
- if (ret < 0)
+ if (ret < 0) {
+ dev_err(pctldev->dev, "can't query groups for function %s\n",
+ map->data.mux.function);
return ret;
- if (!num_groups)
+ }
+ if (!num_groups) {
+ dev_err(pctldev->dev,
+ "function %s can't be selected on any group\n",
+ map->data.mux.function);
return -EINVAL;
+ }
if (map->data.mux.group) {
bool found = false;
@@ -350,15 +360,23 @@ int pinmux_map_to_setting(struct pinctrl_map const *map,
break;
}
}
- if (!found)
+ if (!found) {
+ dev_err(pctldev->dev,
+ "function %s can't be selected on group %s\n",
+ map->data.mux.function, map->data.mux.group);
return -EINVAL;
+ }
} else {
group = groups[0];
}
- setting->data.mux.group = pinctrl_get_group_selector(pctldev, group);
- if (setting->data.mux.group < 0)
- return setting->data.mux.group;
+ ret = pinctrl_get_group_selector(pctldev, group);
+ if (ret < 0) {
+ dev_err(pctldev->dev, "invalid group %s in map table\n",
+ map->data.mux.group);
+ return ret;
+ }
+ setting->data.mux.group = ret;
ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, &pins,
&num_pins);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] pinctrl: add error messages to pinmux_map_to_setting()
2012-04-25 16:34 [PATCH] pinctrl: add error messages to pinmux_map_to_setting() Stephen Warren
@ 2012-04-25 18:06 ` John Crispin
2012-04-26 9:02 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: John Crispin @ 2012-04-25 18:06 UTC (permalink / raw)
To: Stephen Warren; +Cc: Linus Walleij, linux-kernel, Stephen Warren
On 25/04/12 18:34, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> pinmux_map_to_setting() detects a number of errors, but doesn't report
> any specifics to the user, making debugging those errors hard.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> John, Linus,
>
> This is mostly just FYI in case John wants to roll this into his error
> reporting patch - it's all the changes I made to any non-Tegra files when
> debugging my DT map data.
>
> drivers/pinctrl/pinmux.c | 38 ++++++++++++++++++++++++++++----------
> 1 files changed, 28 insertions(+), 10 deletions(-)
Hi Stephen,
I was just about to send my patch. However, I will first fold your
suggestions into it.
Thanks,
John
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: add error messages to pinmux_map_to_setting()
2012-04-25 18:06 ` John Crispin
@ 2012-04-26 9:02 ` Linus Walleij
0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-04-26 9:02 UTC (permalink / raw)
To: John Crispin; +Cc: Stephen Warren, linux-kernel, Stephen Warren
On Wed, Apr 25, 2012 at 8:06 PM, John Crispin <blogic@openwrt.org> wrote:
> On 25/04/12 18:34, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> pinmux_map_to_setting() detects a number of errors, but doesn't report
>> any specifics to the user, making debugging those errors hard.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> John, Linus,
>>
>> This is mostly just FYI in case John wants to roll this into his error
>> reporting patch - it's all the changes I made to any non-Tegra files when
>> debugging my DT map data.
>>
>> drivers/pinctrl/pinmux.c | 38 ++++++++++++++++++++++++++++----------
>> 1 files changed, 28 insertions(+), 10 deletions(-)
> Hi Stephen,
>
> I was just about to send my patch. However, I will first fold your
> suggestions into it.
OK so I don't apply this and wait for the final patch from John.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-26 9:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25 16:34 [PATCH] pinctrl: add error messages to pinmux_map_to_setting() Stephen Warren
2012-04-25 18:06 ` John Crispin
2012-04-26 9:02 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox