diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-02-22 16:25:59 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-02-24 00:26:58 -0500 |
commit | 95dcd4aea57f1d449305f3032240bba0a839593b (patch) | |
tree | f5a94b7ddbfad5e96c56cb64609a0658ed772747 /drivers | |
parent | 1681f5ae4ca25bddb6f7b6d4f463cc83e3d1ad01 (diff) |
pinctrl: use dev_*() instead of pr_*(), add some msgs, minor cleanups
e.g. dev_err instead of pr_err prints messages in a slightly more
standardized format.
Also, add a few more error messages to track down errors.
Also, some small cleanups of messages.
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')
-rw-r--r-- | drivers/pinctrl/core.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 5411e32bb3f6..1d5943069a03 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -212,8 +212,10 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev, | |||
212 | } | 212 | } |
213 | 213 | ||
214 | pindesc = kzalloc(sizeof(*pindesc), GFP_KERNEL); | 214 | pindesc = kzalloc(sizeof(*pindesc), GFP_KERNEL); |
215 | if (pindesc == NULL) | 215 | if (pindesc == NULL) { |
216 | dev_err(pctldev->dev, "failed to alloc struct pin_desc\n"); | ||
216 | return -ENOMEM; | 217 | return -ENOMEM; |
218 | } | ||
217 | 219 | ||
218 | spin_lock_init(&pindesc->lock); | 220 | spin_lock_init(&pindesc->lock); |
219 | 221 | ||
@@ -493,7 +495,7 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name) | |||
493 | 495 | ||
494 | devname = dev_name(dev); | 496 | devname = dev_name(dev); |
495 | 497 | ||
496 | pr_debug("get pin control handle device %s state %s\n", devname, name); | 498 | dev_dbg(dev, "pinctrl_get() for device %s state %s\n", devname, name); |
497 | 499 | ||
498 | /* | 500 | /* |
499 | * create the state cookie holder struct pinctrl for each | 501 | * create the state cookie holder struct pinctrl for each |
@@ -501,8 +503,10 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name) | |||
501 | * a pin control handle with pinctrl_get() | 503 | * a pin control handle with pinctrl_get() |
502 | */ | 504 | */ |
503 | p = kzalloc(sizeof(struct pinctrl), GFP_KERNEL); | 505 | p = kzalloc(sizeof(struct pinctrl), GFP_KERNEL); |
504 | if (p == NULL) | 506 | if (p == NULL) { |
507 | dev_err(dev, "failed to alloc struct pinctrl\n"); | ||
505 | return ERR_PTR(-ENOMEM); | 508 | return ERR_PTR(-ENOMEM); |
509 | } | ||
506 | mutex_init(&p->mutex); | 510 | mutex_init(&p->mutex); |
507 | pinmux_init_pinctrl_handle(p); | 511 | pinmux_init_pinctrl_handle(p); |
508 | 512 | ||
@@ -521,8 +525,8 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name) | |||
521 | return ERR_PTR(-ENODEV); | 525 | return ERR_PTR(-ENODEV); |
522 | } | 526 | } |
523 | 527 | ||
524 | pr_debug("in map, found pctldev %s to handle function %s", | 528 | dev_dbg(dev, "in map, found pctldev %s to handle function %s", |
525 | dev_name(pctldev->dev), map->function); | 529 | dev_name(pctldev->dev), map->function); |
526 | 530 | ||
527 | /* Map must be for this device */ | 531 | /* Map must be for this device */ |
528 | if (strcmp(map->dev_name, devname)) | 532 | if (strcmp(map->dev_name, devname)) |
@@ -558,8 +562,8 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name) | |||
558 | if (!num_maps) | 562 | if (!num_maps) |
559 | dev_info(dev, "zero maps found for mapping %s\n", name); | 563 | dev_info(dev, "zero maps found for mapping %s\n", name); |
560 | 564 | ||
561 | pr_debug("found %u mux maps for device %s, UD %s\n", | 565 | dev_dbg(dev, "found %u maps for device %s state %s\n", |
562 | num_maps, devname, name ? name : "(undefined)"); | 566 | num_maps, devname, name ? name : "(undefined)"); |
563 | 567 | ||
564 | /* Add the pinmux to the global list */ | 568 | /* Add the pinmux to the global list */ |
565 | mutex_lock(&pinctrl_list_mutex); | 569 | mutex_lock(&pinctrl_list_mutex); |
@@ -670,7 +674,7 @@ int pinctrl_register_mappings(struct pinctrl_map const *maps, | |||
670 | for (i = 0; i < num_maps; i++) { | 674 | for (i = 0; i < num_maps; i++) { |
671 | if (!maps[i].name) { | 675 | if (!maps[i].name) { |
672 | pr_err("failed to register map %d: no map name given\n", | 676 | pr_err("failed to register map %d: no map name given\n", |
673 | i); | 677 | i); |
674 | return -EINVAL; | 678 | return -EINVAL; |
675 | } | 679 | } |
676 | 680 | ||
@@ -682,13 +686,13 @@ int pinctrl_register_mappings(struct pinctrl_map const *maps, | |||
682 | 686 | ||
683 | if (!maps[i].function) { | 687 | if (!maps[i].function) { |
684 | pr_err("failed to register map %s (%d): no function ID given\n", | 688 | pr_err("failed to register map %s (%d): no function ID given\n", |
685 | maps[i].name, i); | 689 | maps[i].name, i); |
686 | return -EINVAL; | 690 | return -EINVAL; |
687 | } | 691 | } |
688 | 692 | ||
689 | if (!maps[i].dev_name) { | 693 | if (!maps[i].dev_name) { |
690 | pr_err("failed to register map %s (%d): no device given\n", | 694 | pr_err("failed to register map %s (%d): no device given\n", |
691 | maps[i].name, i); | 695 | maps[i].name, i); |
692 | return -EINVAL; | 696 | return -EINVAL; |
693 | } | 697 | } |
694 | } | 698 | } |
@@ -702,6 +706,7 @@ int pinctrl_register_mappings(struct pinctrl_map const *maps, | |||
702 | maps_node->num_maps = num_maps; | 706 | maps_node->num_maps = num_maps; |
703 | maps_node->maps = kmemdup(maps, sizeof(*maps) * num_maps, GFP_KERNEL); | 707 | maps_node->maps = kmemdup(maps, sizeof(*maps) * num_maps, GFP_KERNEL); |
704 | if (!maps_node->maps) { | 708 | if (!maps_node->maps) { |
709 | pr_err("failed to duplicate mapping table\n"); | ||
705 | kfree(maps_node); | 710 | kfree(maps_node); |
706 | return -ENOMEM; | 711 | return -ENOMEM; |
707 | } | 712 | } |
@@ -722,8 +727,10 @@ static int pinctrl_hog_map(struct pinctrl_dev *pctldev, | |||
722 | int ret; | 727 | int ret; |
723 | 728 | ||
724 | hog = kzalloc(sizeof(struct pinctrl_hog), GFP_KERNEL); | 729 | hog = kzalloc(sizeof(struct pinctrl_hog), GFP_KERNEL); |
725 | if (!hog) | 730 | if (!hog) { |
731 | dev_err(pctldev->dev, "failed to alloc struct pinctrl_hog\n"); | ||
726 | return -ENOMEM; | 732 | return -ENOMEM; |
733 | } | ||
727 | 734 | ||
728 | p = pinctrl_get_locked(pctldev->dev, map->name); | 735 | p = pinctrl_get_locked(pctldev->dev, map->name); |
729 | if (IS_ERR(p)) { | 736 | if (IS_ERR(p)) { |
@@ -1154,8 +1161,10 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
1154 | return NULL; | 1161 | return NULL; |
1155 | 1162 | ||
1156 | pctldev = kzalloc(sizeof(struct pinctrl_dev), GFP_KERNEL); | 1163 | pctldev = kzalloc(sizeof(struct pinctrl_dev), GFP_KERNEL); |
1157 | if (pctldev == NULL) | 1164 | if (pctldev == NULL) { |
1165 | dev_err(dev, "failed to alloc struct pinctrl_dev\n"); | ||
1158 | return NULL; | 1166 | return NULL; |
1167 | } | ||
1159 | 1168 | ||
1160 | /* Initialize pin control device struct */ | 1169 | /* Initialize pin control device struct */ |
1161 | pctldev->owner = pctldesc->owner; | 1170 | pctldev->owner = pctldesc->owner; |