diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-08-14 12:23:33 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-08-14 16:49:14 -0400 |
commit | 1c8e794432c2ee752599bf114f3e8bd683674e3d (patch) | |
tree | 86ecddf19de5d2ca48696d8a2c0e82bf43b03c0d /drivers/pinctrl/pinmux.c | |
parent | 0a8d3e2412841c6b1dab1006fd5f7ab5b689db21 (diff) |
pinctrl: improve warning messages
Print out the affected group name on activation of pin mux
settings, and warn if you cannot free a pin that should have
been part of a certain setting.
ChangeLog v1->v2:
- Also print the pin name in the error messages.
Cc: Sonic Zhang <sonic.zhang@analog.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinmux.c')
-rw-r--r-- | drivers/pinctrl/pinmux.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 5f5158856ea9..9d144a263dc2 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c | |||
@@ -400,10 +400,14 @@ int pinmux_enable_setting(struct pinctrl_setting const *setting) | |||
400 | ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, | 400 | ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, |
401 | &pins, &num_pins); | 401 | &pins, &num_pins); |
402 | if (ret) { | 402 | if (ret) { |
403 | const char *gname; | ||
404 | |||
403 | /* errors only affect debug data, so just warn */ | 405 | /* errors only affect debug data, so just warn */ |
406 | gname = pctlops->get_group_name(pctldev, | ||
407 | setting->data.mux.group); | ||
404 | dev_warn(pctldev->dev, | 408 | dev_warn(pctldev->dev, |
405 | "could not get pins for group selector %d\n", | 409 | "could not get pins for group %s\n", |
406 | setting->data.mux.group); | 410 | gname); |
407 | num_pins = 0; | 411 | num_pins = 0; |
408 | } | 412 | } |
409 | 413 | ||
@@ -411,9 +415,18 @@ int pinmux_enable_setting(struct pinctrl_setting const *setting) | |||
411 | for (i = 0; i < num_pins; i++) { | 415 | for (i = 0; i < num_pins; i++) { |
412 | ret = pin_request(pctldev, pins[i], setting->dev_name, NULL); | 416 | ret = pin_request(pctldev, pins[i], setting->dev_name, NULL); |
413 | if (ret) { | 417 | if (ret) { |
418 | const char *gname; | ||
419 | const char *pname; | ||
420 | |||
421 | desc = pin_desc_get(pctldev, pins[i]); | ||
422 | pname = desc ? desc->name : "non-existing"; | ||
423 | gname = pctlops->get_group_name(pctldev, | ||
424 | setting->data.mux.group); | ||
414 | dev_err(pctldev->dev, | 425 | dev_err(pctldev->dev, |
415 | "could not request pin %d on device %s\n", | 426 | "could not request pin %d (%s) from group %s " |
416 | pins[i], pinctrl_dev_get_name(pctldev)); | 427 | " on device %s\n", |
428 | pins[i], pname, gname, | ||
429 | pinctrl_dev_get_name(pctldev)); | ||
417 | goto err_pin_request; | 430 | goto err_pin_request; |
418 | } | 431 | } |
419 | } | 432 | } |
@@ -466,10 +479,14 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting) | |||
466 | ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, | 479 | ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, |
467 | &pins, &num_pins); | 480 | &pins, &num_pins); |
468 | if (ret) { | 481 | if (ret) { |
482 | const char *gname; | ||
483 | |||
469 | /* errors only affect debug data, so just warn */ | 484 | /* errors only affect debug data, so just warn */ |
485 | gname = pctlops->get_group_name(pctldev, | ||
486 | setting->data.mux.group); | ||
470 | dev_warn(pctldev->dev, | 487 | dev_warn(pctldev->dev, |
471 | "could not get pins for group selector %d\n", | 488 | "could not get pins for group %s\n", |
472 | setting->data.mux.group); | 489 | gname); |
473 | num_pins = 0; | 490 | num_pins = 0; |
474 | } | 491 | } |
475 | 492 | ||
@@ -486,6 +503,18 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting) | |||
486 | desc->mux_setting = NULL; | 503 | desc->mux_setting = NULL; |
487 | /* And release the pin */ | 504 | /* And release the pin */ |
488 | pin_free(pctldev, pins[i], NULL); | 505 | pin_free(pctldev, pins[i], NULL); |
506 | } else { | ||
507 | const char *gname; | ||
508 | const char *pname; | ||
509 | |||
510 | pname = desc ? desc->name : "non-existing"; | ||
511 | gname = pctlops->get_group_name(pctldev, | ||
512 | setting->data.mux.group); | ||
513 | dev_warn(pctldev->dev, | ||
514 | "not freeing pin %d (%s) as part of " | ||
515 | "deactivating group %s - it is already " | ||
516 | "used for some other setting", | ||
517 | pins[i], pname, gname); | ||
489 | } | 518 | } |
490 | } | 519 | } |
491 | 520 | ||