aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-11-30 08:53:48 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-01-12 09:33:01 -0500
commit5da84fd99bb1ab1c7cd39d0cf7c08bb63931a59a (patch)
tree0ab55784387aacdbc9e3b94c0cf3491a5124d604
parent6220b87bfd60d77bf9b19e18aa093110b0f34d41 (diff)
regulator: Add and use rdev_<level> macros
On Tue, 2010-11-30 at 10:52 +0000, Mark Brown wrote: > On Mon, Nov 29, 2010 at 05:12:56PM -0800, Joe Perches wrote: > > Just to please broonie... > > Signed-off-by: Joe Perches <joe@perches.com> > As usual when fixing review issues please revise your original patch > rather than posting a fresh patch. Here's an earlier comment: On Thu, 2010-11-18 at 13:30 +0000, Mark Brown wrote: > This looks reasonable, please rebase on top of Daniel's patches and > submit it properly (with changelog and so on). Sometimes it's simpler for an upstream maintainer to do something like: git am -s <patch1.mbox> patch -p1 < patch2.mbox git commit --amend file instead of back and forthing. Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--drivers/regulator/core.c146
1 files changed, 65 insertions, 81 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 40cf7b9ea943..e63366f826f9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -32,6 +32,15 @@
32 32
33#include "dummy.h" 33#include "dummy.h"
34 34
35#define rdev_err(rdev, fmt, ...) \
36 pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
37#define rdev_warn(rdev, fmt, ...) \
38 pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
39#define rdev_info(rdev, fmt, ...) \
40 pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
41#define rdev_dbg(rdev, fmt, ...) \
42 pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
43
35static DEFINE_MUTEX(regulator_list_mutex); 44static DEFINE_MUTEX(regulator_list_mutex);
36static LIST_HEAD(regulator_list); 45static LIST_HEAD(regulator_list);
37static LIST_HEAD(regulator_map_list); 46static LIST_HEAD(regulator_map_list);
@@ -114,11 +123,11 @@ static int regulator_check_voltage(struct regulator_dev *rdev,
114 BUG_ON(*min_uV > *max_uV); 123 BUG_ON(*min_uV > *max_uV);
115 124
116 if (!rdev->constraints) { 125 if (!rdev->constraints) {
117 pr_err("no constraints for %s\n", rdev_get_name(rdev)); 126 rdev_err(rdev, "no constraints\n");
118 return -ENODEV; 127 return -ENODEV;
119 } 128 }
120 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { 129 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
121 pr_err("operation not allowed for %s\n", rdev_get_name(rdev)); 130 rdev_err(rdev, "operation not allowed\n");
122 return -EPERM; 131 return -EPERM;
123 } 132 }
124 133
@@ -140,11 +149,11 @@ static int regulator_check_current_limit(struct regulator_dev *rdev,
140 BUG_ON(*min_uA > *max_uA); 149 BUG_ON(*min_uA > *max_uA);
141 150
142 if (!rdev->constraints) { 151 if (!rdev->constraints) {
143 pr_err("no constraints for %s\n", rdev_get_name(rdev)); 152 rdev_err(rdev, "no constraints\n");
144 return -ENODEV; 153 return -ENODEV;
145 } 154 }
146 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) { 155 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) {
147 pr_err("operation not allowed for %s\n", rdev_get_name(rdev)); 156 rdev_err(rdev, "operation not allowed\n");
148 return -EPERM; 157 return -EPERM;
149 } 158 }
150 159
@@ -173,15 +182,15 @@ static int regulator_check_mode(struct regulator_dev *rdev, int mode)
173 } 182 }
174 183
175 if (!rdev->constraints) { 184 if (!rdev->constraints) {
176 pr_err("no constraints for %s\n", rdev_get_name(rdev)); 185 rdev_err(rdev, "no constraints\n");
177 return -ENODEV; 186 return -ENODEV;
178 } 187 }
179 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) { 188 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) {
180 pr_err("operation not allowed for %s\n", rdev_get_name(rdev)); 189 rdev_err(rdev, "operation not allowed\n");
181 return -EPERM; 190 return -EPERM;
182 } 191 }
183 if (!(rdev->constraints->valid_modes_mask & mode)) { 192 if (!(rdev->constraints->valid_modes_mask & mode)) {
184 pr_err("invalid mode %x for %s\n", mode, rdev_get_name(rdev)); 193 rdev_err(rdev, "invalid mode %x\n", mode);
185 return -EINVAL; 194 return -EINVAL;
186 } 195 }
187 return 0; 196 return 0;
@@ -191,11 +200,11 @@ static int regulator_check_mode(struct regulator_dev *rdev, int mode)
191static int regulator_check_drms(struct regulator_dev *rdev) 200static int regulator_check_drms(struct regulator_dev *rdev)
192{ 201{
193 if (!rdev->constraints) { 202 if (!rdev->constraints) {
194 pr_err("no constraints for %s\n", rdev_get_name(rdev)); 203 rdev_err(rdev, "no constraints\n");
195 return -ENODEV; 204 return -ENODEV;
196 } 205 }
197 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) { 206 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) {
198 pr_err("operation not allowed for %s\n", rdev_get_name(rdev)); 207 rdev_err(rdev, "operation not allowed\n");
199 return -EPERM; 208 return -EPERM;
200 } 209 }
201 return 0; 210 return 0;
@@ -592,18 +601,17 @@ static int suspend_set_state(struct regulator_dev *rdev,
592 */ 601 */
593 if (!rstate->enabled && !rstate->disabled) { 602 if (!rstate->enabled && !rstate->disabled) {
594 if (can_set_state) 603 if (can_set_state)
595 pr_warning("No configuration for %s\n", 604 rdev_warn(rdev, "No configuration\n");
596 rdev_get_name(rdev));
597 return 0; 605 return 0;
598 } 606 }
599 607
600 if (rstate->enabled && rstate->disabled) { 608 if (rstate->enabled && rstate->disabled) {
601 pr_err("invalid configuration for %s\n", rdev_get_name(rdev)); 609 rdev_err(rdev, "invalid configuration\n");
602 return -EINVAL; 610 return -EINVAL;
603 } 611 }
604 612
605 if (!can_set_state) { 613 if (!can_set_state) {
606 pr_err("no way to set suspend state\n"); 614 rdev_err(rdev, "no way to set suspend state\n");
607 return -EINVAL; 615 return -EINVAL;
608 } 616 }
609 617
@@ -612,14 +620,14 @@ static int suspend_set_state(struct regulator_dev *rdev,
612 else 620 else
613 ret = rdev->desc->ops->set_suspend_disable(rdev); 621 ret = rdev->desc->ops->set_suspend_disable(rdev);
614 if (ret < 0) { 622 if (ret < 0) {
615 pr_err("failed to enabled/disable\n"); 623 rdev_err(rdev, "failed to enabled/disable\n");
616 return ret; 624 return ret;
617 } 625 }
618 626
619 if (rdev->desc->ops->set_suspend_voltage && rstate->uV > 0) { 627 if (rdev->desc->ops->set_suspend_voltage && rstate->uV > 0) {
620 ret = rdev->desc->ops->set_suspend_voltage(rdev, rstate->uV); 628 ret = rdev->desc->ops->set_suspend_voltage(rdev, rstate->uV);
621 if (ret < 0) { 629 if (ret < 0) {
622 pr_err("failed to set voltage\n"); 630 rdev_err(rdev, "failed to set voltage\n");
623 return ret; 631 return ret;
624 } 632 }
625 } 633 }
@@ -627,7 +635,7 @@ static int suspend_set_state(struct regulator_dev *rdev,
627 if (rdev->desc->ops->set_suspend_mode && rstate->mode > 0) { 635 if (rdev->desc->ops->set_suspend_mode && rstate->mode > 0) {
628 ret = rdev->desc->ops->set_suspend_mode(rdev, rstate->mode); 636 ret = rdev->desc->ops->set_suspend_mode(rdev, rstate->mode);
629 if (ret < 0) { 637 if (ret < 0) {
630 pr_err("failed to set mode\n"); 638 rdev_err(rdev, "failed to set mode\n");
631 return ret; 639 return ret;
632 } 640 }
633 } 641 }
@@ -705,14 +713,13 @@ static void print_constraints(struct regulator_dev *rdev)
705 if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY) 713 if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY)
706 count += sprintf(buf + count, "standby"); 714 count += sprintf(buf + count, "standby");
707 715
708 printk(KERN_INFO "regulator: %s: %s\n", rdev_get_name(rdev), buf); 716 rdev_info(rdev, "regulator: %s\n", buf);
709} 717}
710 718
711static int machine_constraints_voltage(struct regulator_dev *rdev, 719static int machine_constraints_voltage(struct regulator_dev *rdev,
712 struct regulation_constraints *constraints) 720 struct regulation_constraints *constraints)
713{ 721{
714 struct regulator_ops *ops = rdev->desc->ops; 722 struct regulator_ops *ops = rdev->desc->ops;
715 const char *name = rdev_get_name(rdev);
716 int ret; 723 int ret;
717 unsigned selector; 724 unsigned selector;
718 725
@@ -725,8 +732,8 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
725 rdev->constraints->max_uV, 732 rdev->constraints->max_uV,
726 &selector); 733 &selector);
727 if (ret < 0) { 734 if (ret < 0) {
728 pr_err("failed to apply %duV constraint to %s\n", 735 rdev_err(rdev, "failed to apply %duV constraint\n",
729 rdev->constraints->min_uV, name); 736 rdev->constraints->min_uV);
730 rdev->constraints = NULL; 737 rdev->constraints = NULL;
731 return ret; 738 return ret;
732 } 739 }
@@ -758,8 +765,7 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
758 765
759 /* else require explicit machine-level constraints */ 766 /* else require explicit machine-level constraints */
760 if (cmin <= 0 || cmax <= 0 || cmax < cmin) { 767 if (cmin <= 0 || cmax <= 0 || cmax < cmin) {
761 pr_err("invalid '%s' voltage constraints\n", 768 rdev_err(rdev, "invalid voltage constraints\n");
762 name);
763 return -EINVAL; 769 return -EINVAL;
764 } 770 }
765 771
@@ -780,20 +786,19 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
780 786
781 /* final: [min_uV..max_uV] valid iff constraints valid */ 787 /* final: [min_uV..max_uV] valid iff constraints valid */
782 if (max_uV < min_uV) { 788 if (max_uV < min_uV) {
783 pr_err("unsupportable '%s' voltage constraints\n", 789 rdev_err(rdev, "unsupportable voltage constraints\n");
784 name);
785 return -EINVAL; 790 return -EINVAL;
786 } 791 }
787 792
788 /* use regulator's subset of machine constraints */ 793 /* use regulator's subset of machine constraints */
789 if (constraints->min_uV < min_uV) { 794 if (constraints->min_uV < min_uV) {
790 pr_debug("override '%s' min_uV, %d -> %d\n", 795 rdev_dbg(rdev, "override min_uV, %d -> %d\n",
791 name, constraints->min_uV, min_uV); 796 constraints->min_uV, min_uV);
792 constraints->min_uV = min_uV; 797 constraints->min_uV = min_uV;
793 } 798 }
794 if (constraints->max_uV > max_uV) { 799 if (constraints->max_uV > max_uV) {
795 pr_debug("override '%s' max_uV, %d -> %d\n", 800 rdev_dbg(rdev, "override max_uV, %d -> %d\n",
796 name, constraints->max_uV, max_uV); 801 constraints->max_uV, max_uV);
797 constraints->max_uV = max_uV; 802 constraints->max_uV = max_uV;
798 } 803 }
799 } 804 }
@@ -816,7 +821,6 @@ static int set_machine_constraints(struct regulator_dev *rdev,
816 const struct regulation_constraints *constraints) 821 const struct regulation_constraints *constraints)
817{ 822{
818 int ret = 0; 823 int ret = 0;
819 const char *name;
820 struct regulator_ops *ops = rdev->desc->ops; 824 struct regulator_ops *ops = rdev->desc->ops;
821 825
822 rdev->constraints = kmemdup(constraints, sizeof(*constraints), 826 rdev->constraints = kmemdup(constraints, sizeof(*constraints),
@@ -824,8 +828,6 @@ static int set_machine_constraints(struct regulator_dev *rdev,
824 if (!rdev->constraints) 828 if (!rdev->constraints)
825 return -ENOMEM; 829 return -ENOMEM;
826 830
827 name = rdev_get_name(rdev);
828
829 ret = machine_constraints_voltage(rdev, rdev->constraints); 831 ret = machine_constraints_voltage(rdev, rdev->constraints);
830 if (ret != 0) 832 if (ret != 0)
831 goto out; 833 goto out;
@@ -834,8 +836,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
834 if (constraints->initial_state) { 836 if (constraints->initial_state) {
835 ret = suspend_prepare(rdev, rdev->constraints->initial_state); 837 ret = suspend_prepare(rdev, rdev->constraints->initial_state);
836 if (ret < 0) { 838 if (ret < 0) {
837 pr_err("failed to set suspend state for %s\n", 839 rdev_err(rdev, "failed to set suspend state\n");
838 name);
839 rdev->constraints = NULL; 840 rdev->constraints = NULL;
840 goto out; 841 goto out;
841 } 842 }
@@ -843,16 +844,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
843 844
844 if (constraints->initial_mode) { 845 if (constraints->initial_mode) {
845 if (!ops->set_mode) { 846 if (!ops->set_mode) {
846 pr_err("no set_mode operation for %s\n", 847 rdev_err(rdev, "no set_mode operation\n");
847 name);
848 ret = -EINVAL; 848 ret = -EINVAL;
849 goto out; 849 goto out;
850 } 850 }
851 851
852 ret = ops->set_mode(rdev, rdev->constraints->initial_mode); 852 ret = ops->set_mode(rdev, rdev->constraints->initial_mode);
853 if (ret < 0) { 853 if (ret < 0) {
854 pr_err("failed to set initial mode for %s: %d\n", 854 rdev_err(rdev, "failed to set initial mode: %d\n", ret);
855 name, ret);
856 goto out; 855 goto out;
857 } 856 }
858 } 857 }
@@ -864,7 +863,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
864 ops->enable) { 863 ops->enable) {
865 ret = ops->enable(rdev); 864 ret = ops->enable(rdev);
866 if (ret < 0) { 865 if (ret < 0) {
867 pr_err("failed to enable %s\n", name); 866 rdev_err(rdev, "failed to enable\n");
868 rdev->constraints = NULL; 867 rdev->constraints = NULL;
869 goto out; 868 goto out;
870 } 869 }
@@ -892,8 +891,8 @@ static int set_supply(struct regulator_dev *rdev,
892 err = sysfs_create_link(&rdev->dev.kobj, &supply_rdev->dev.kobj, 891 err = sysfs_create_link(&rdev->dev.kobj, &supply_rdev->dev.kobj,
893 "supply"); 892 "supply");
894 if (err) { 893 if (err) {
895 pr_err("could not add device link %s err %d\n", 894 rdev_err(rdev, "could not add device link %s err %d\n",
896 supply_rdev->dev.kobj.name, err); 895 supply_rdev->dev.kobj.name, err);
897 goto out; 896 goto out;
898 } 897 }
899 rdev->supply = supply_rdev; 898 rdev->supply = supply_rdev;
@@ -949,10 +948,10 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
949 continue; 948 continue;
950 949
951 dev_dbg(consumer_dev, "%s/%s is '%s' supply; fail %s/%s\n", 950 dev_dbg(consumer_dev, "%s/%s is '%s' supply; fail %s/%s\n",
952 dev_name(&node->regulator->dev), 951 dev_name(&node->regulator->dev),
953 node->regulator->desc->name, 952 node->regulator->desc->name,
954 supply, 953 supply,
955 dev_name(&rdev->dev), rdev_get_name(rdev)); 954 dev_name(&rdev->dev), rdev_get_name(rdev));
956 return -EBUSY; 955 return -EBUSY;
957 } 956 }
958 957
@@ -1023,8 +1022,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
1023 regulator->dev_attr.show = device_requested_uA_show; 1022 regulator->dev_attr.show = device_requested_uA_show;
1024 err = device_create_file(dev, &regulator->dev_attr); 1023 err = device_create_file(dev, &regulator->dev_attr);
1025 if (err < 0) { 1024 if (err < 0) {
1026 pr_warning("could not add regulator_dev" 1025 rdev_warn(rdev, "could not add regulator_dev requested microamps sysfs entry\n");
1027 " requested microamps sysfs entry\n");
1028 goto attr_name_err; 1026 goto attr_name_err;
1029 } 1027 }
1030 1028
@@ -1041,8 +1039,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
1041 err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj, 1039 err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj,
1042 buf); 1040 buf);
1043 if (err) { 1041 if (err) {
1044 pr_warning("could not add device link %s err %d\n", 1042 rdev_warn(rdev, "could not add device link %s err %d\n",
1045 dev->kobj.name, err); 1043 dev->kobj.name, err);
1046 goto link_name_err; 1044 goto link_name_err;
1047 } 1045 }
1048 } 1046 }
@@ -1079,7 +1077,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
1079 int ret; 1077 int ret;
1080 1078
1081 if (id == NULL) { 1079 if (id == NULL) {
1082 pr_err("regulator: get() with no identifier\n"); 1080 pr_err("get() with no identifier\n");
1083 return regulator; 1081 return regulator;
1084 } 1082 }
1085 1083
@@ -1113,8 +1111,8 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
1113 * substitute in a dummy regulator so consumers can continue. 1111 * substitute in a dummy regulator so consumers can continue.
1114 */ 1112 */
1115 if (!has_full_constraints) { 1113 if (!has_full_constraints) {
1116 pr_warning("%s supply %s not found, using dummy regulator\n", 1114 pr_warn("%s supply %s not found, using dummy regulator\n",
1117 devname, id); 1115 devname, id);
1118 rdev = dummy_regulator_rdev; 1116 rdev = dummy_regulator_rdev;
1119 goto found; 1117 goto found;
1120 } 1118 }
@@ -1265,8 +1263,7 @@ static int _regulator_enable(struct regulator_dev *rdev)
1265 ret = _regulator_enable(rdev->supply); 1263 ret = _regulator_enable(rdev->supply);
1266 mutex_unlock(&rdev->supply->mutex); 1264 mutex_unlock(&rdev->supply->mutex);
1267 if (ret < 0) { 1265 if (ret < 0) {
1268 pr_err("failed to enable %s: %d\n", 1266 rdev_err(rdev, "failed to enable: %d\n", ret);
1269 rdev_get_name(rdev), ret);
1270 return ret; 1267 return ret;
1271 } 1268 }
1272 } 1269 }
@@ -1293,8 +1290,7 @@ static int _regulator_enable(struct regulator_dev *rdev)
1293 if (ret >= 0) { 1290 if (ret >= 0) {
1294 delay = ret; 1291 delay = ret;
1295 } else { 1292 } else {
1296 pr_warning("enable_time() failed for %s: %d\n", 1293 rdev_warn(rdev, "enable_time() failed: %d\n",
1297 rdev_get_name(rdev),
1298 ret); 1294 ret);
1299 delay = 0; 1295 delay = 0;
1300 } 1296 }
@@ -1320,8 +1316,7 @@ static int _regulator_enable(struct regulator_dev *rdev)
1320 trace_regulator_enable_complete(rdev_get_name(rdev)); 1316 trace_regulator_enable_complete(rdev_get_name(rdev));
1321 1317
1322 } else if (ret < 0) { 1318 } else if (ret < 0) {
1323 pr_err("is_enabled() failed for %s: %d\n", 1319 rdev_err(rdev, "is_enabled() failed: %d\n", ret);
1324 rdev_get_name(rdev), ret);
1325 return ret; 1320 return ret;
1326 } 1321 }
1327 /* Fallthrough on positive return values - already enabled */ 1322 /* Fallthrough on positive return values - already enabled */
@@ -1378,8 +1373,7 @@ static int _regulator_disable(struct regulator_dev *rdev,
1378 1373
1379 ret = rdev->desc->ops->disable(rdev); 1374 ret = rdev->desc->ops->disable(rdev);
1380 if (ret < 0) { 1375 if (ret < 0) {
1381 pr_err("failed to disable %s\n", 1376 rdev_err(rdev, "failed to disable\n");
1382 rdev_get_name(rdev));
1383 return ret; 1377 return ret;
1384 } 1378 }
1385 1379
@@ -1451,8 +1445,7 @@ static int _regulator_force_disable(struct regulator_dev *rdev,
1451 /* ah well, who wants to live forever... */ 1445 /* ah well, who wants to live forever... */
1452 ret = rdev->desc->ops->disable(rdev); 1446 ret = rdev->desc->ops->disable(rdev);
1453 if (ret < 0) { 1447 if (ret < 0) {
1454 pr_err("failed to force disable %s\n", 1448 rdev_err(rdev, "failed to force disable\n");
1455 rdev_get_name(rdev));
1456 return ret; 1449 return ret;
1457 } 1450 }
1458 /* notify other consumers that power has been forced off */ 1451 /* notify other consumers that power has been forced off */
@@ -1893,8 +1886,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1893 /* get output voltage */ 1886 /* get output voltage */
1894 output_uV = rdev->desc->ops->get_voltage(rdev); 1887 output_uV = rdev->desc->ops->get_voltage(rdev);
1895 if (output_uV <= 0) { 1888 if (output_uV <= 0) {
1896 pr_err("invalid output voltage found for %s\n", 1889 rdev_err(rdev, "invalid output voltage found\n");
1897 rdev_get_name(rdev));
1898 goto out; 1890 goto out;
1899 } 1891 }
1900 1892
@@ -1904,8 +1896,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1904 else 1896 else
1905 input_uV = rdev->constraints->input_uV; 1897 input_uV = rdev->constraints->input_uV;
1906 if (input_uV <= 0) { 1898 if (input_uV <= 0) {
1907 pr_err("invalid input voltage found for %s\n", 1899 rdev_err(rdev, "invalid input voltage found\n");
1908 rdev_get_name(rdev));
1909 goto out; 1900 goto out;
1910 } 1901 }
1911 1902
@@ -1918,16 +1909,14 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1918 total_uA_load); 1909 total_uA_load);
1919 ret = regulator_check_mode(rdev, mode); 1910 ret = regulator_check_mode(rdev, mode);
1920 if (ret < 0) { 1911 if (ret < 0) {
1921 pr_err("failed to get optimum mode for %s @" 1912 rdev_err(rdev, "failed to get optimum mode @ %d uA %d -> %d uV\n",
1922 " %d uA %d -> %d uV\n", rdev_get_name(rdev), 1913 total_uA_load, input_uV, output_uV);
1923 total_uA_load, input_uV, output_uV);
1924 goto out; 1914 goto out;
1925 } 1915 }
1926 1916
1927 ret = rdev->desc->ops->set_mode(rdev, mode); 1917 ret = rdev->desc->ops->set_mode(rdev, mode);
1928 if (ret < 0) { 1918 if (ret < 0) {
1929 pr_err("failed to set optimum mode %x for %s\n", 1919 rdev_err(rdev, "failed to set optimum mode %x\n", mode);
1930 mode, rdev_get_name(rdev));
1931 goto out; 1920 goto out;
1932 } 1921 }
1933 ret = mode; 1922 ret = mode;
@@ -2058,7 +2047,7 @@ int regulator_bulk_enable(int num_consumers,
2058 return 0; 2047 return 0;
2059 2048
2060err: 2049err:
2061 printk(KERN_ERR "Failed to enable %s: %d\n", consumers[i].supply, ret); 2050 pr_err("Failed to enable %s: %d\n", consumers[i].supply, ret);
2062 for (--i; i >= 0; --i) 2051 for (--i; i >= 0; --i)
2063 regulator_disable(consumers[i].consumer); 2052 regulator_disable(consumers[i].consumer);
2064 2053
@@ -2093,8 +2082,7 @@ int regulator_bulk_disable(int num_consumers,
2093 return 0; 2082 return 0;
2094 2083
2095err: 2084err:
2096 printk(KERN_ERR "Failed to disable %s: %d\n", consumers[i].supply, 2085 pr_err("Failed to disable %s: %d\n", consumers[i].supply, ret);
2097 ret);
2098 for (--i; i >= 0; --i) 2086 for (--i; i >= 0; --i)
2099 regulator_enable(consumers[i].consumer); 2087 regulator_enable(consumers[i].consumer);
2100 2088
@@ -2477,7 +2465,7 @@ int regulator_suspend_prepare(suspend_state_t state)
2477 mutex_unlock(&rdev->mutex); 2465 mutex_unlock(&rdev->mutex);
2478 2466
2479 if (ret < 0) { 2467 if (ret < 0) {
2480 pr_err("failed to prepare %s\n", rdev_get_name(rdev)); 2468 rdev_err(rdev, "failed to prepare\n");
2481 goto out; 2469 goto out;
2482 } 2470 }
2483 } 2471 }
@@ -2599,7 +2587,6 @@ static int __init regulator_init_complete(void)
2599 struct regulator_ops *ops; 2587 struct regulator_ops *ops;
2600 struct regulation_constraints *c; 2588 struct regulation_constraints *c;
2601 int enabled, ret; 2589 int enabled, ret;
2602 const char *name;
2603 2590
2604 mutex_lock(&regulator_list_mutex); 2591 mutex_lock(&regulator_list_mutex);
2605 2592
@@ -2611,8 +2598,6 @@ static int __init regulator_init_complete(void)
2611 ops = rdev->desc->ops; 2598 ops = rdev->desc->ops;
2612 c = rdev->constraints; 2599 c = rdev->constraints;
2613 2600
2614 name = rdev_get_name(rdev);
2615
2616 if (!ops->disable || (c && c->always_on)) 2601 if (!ops->disable || (c && c->always_on))
2617 continue; 2602 continue;
2618 2603
@@ -2633,10 +2618,10 @@ static int __init regulator_init_complete(void)
2633 if (has_full_constraints) { 2618 if (has_full_constraints) {
2634 /* We log since this may kill the system if it 2619 /* We log since this may kill the system if it
2635 * goes wrong. */ 2620 * goes wrong. */
2636 pr_info("disabling %s\n", name); 2621 rdev_info(rdev, "disabling\n");
2637 ret = ops->disable(rdev); 2622 ret = ops->disable(rdev);
2638 if (ret != 0) { 2623 if (ret != 0) {
2639 pr_err("couldn't disable %s: %d\n", name, ret); 2624 rdev_err(rdev, "couldn't disable: %d\n", ret);
2640 } 2625 }
2641 } else { 2626 } else {
2642 /* The intention is that in future we will 2627 /* The intention is that in future we will
@@ -2644,8 +2629,7 @@ static int __init regulator_init_complete(void)
2644 * so warn even if we aren't going to do 2629 * so warn even if we aren't going to do
2645 * anything here. 2630 * anything here.
2646 */ 2631 */
2647 pr_warning("incomplete constraints, leaving %s on\n", 2632 rdev_warn(rdev, "incomplete constraints, leaving on\n");
2648 name);
2649 } 2633 }
2650 2634
2651unlock: 2635unlock: