aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 65e07b941a36..04408896705e 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -669,6 +669,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
669 struct regulation_constraints *constraints) 669 struct regulation_constraints *constraints)
670{ 670{
671 int ret = 0; 671 int ret = 0;
672 const char *name;
673
674 if (constraints->name)
675 name = constraints->name;
676 else if (rdev->desc->name)
677 name = rdev->desc->name;
678 else
679 name = "regulator";
672 680
673 rdev->constraints = constraints; 681 rdev->constraints = constraints;
674 682
@@ -679,9 +687,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,
679 ret = rdev->desc->ops->set_voltage(rdev, 687 ret = rdev->desc->ops->set_voltage(rdev,
680 rdev->constraints->min_uV, rdev->constraints->max_uV); 688 rdev->constraints->min_uV, rdev->constraints->max_uV);
681 if (ret < 0) { 689 if (ret < 0) {
682 printk(KERN_ERR "%s: failed to apply %duV" 690 printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
683 " constraint\n", __func__, 691 __func__,
684 rdev->constraints->min_uV); 692 rdev->constraints->min_uV, name);
685 rdev->constraints = NULL; 693 rdev->constraints = NULL;
686 goto out; 694 goto out;
687 } 695 }
@@ -692,8 +700,15 @@ static int set_machine_constraints(struct regulator_dev *rdev,
692 rdev->use_count = 1; 700 rdev->use_count = 1;
693 701
694 /* do we need to setup our suspend state */ 702 /* do we need to setup our suspend state */
695 if (constraints->initial_state) 703 if (constraints->initial_state) {
696 ret = suspend_prepare(rdev, constraints->initial_state); 704 ret = suspend_prepare(rdev, constraints->initial_state);
705 if (ret < 0) {
706 printk(KERN_ERR "%s: failed to set suspend state for %s\n",
707 __func__, name);
708 rdev->constraints = NULL;
709 goto out;
710 }
711 }
697 712
698 print_constraints(rdev); 713 print_constraints(rdev);
699out: 714out: