aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorDaniel Walker <dwalker@codeaurora.org>2010-11-17 18:30:28 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-01-12 09:33:00 -0500
commit1d7372e15ebd7f56a336fabe6ee31f8e692cd9cb (patch)
tree52262d7e59e357a3ab220b21294fb61157e48d9c /drivers/regulator
parentc5e28ed78274468b92522e7f1e9a5e6080559100 (diff)
drivers: regulator: core: convert to using pr_ macros
The regulator framework uses a lot of printks with a specific formatting using __func__. This converts them to use pr_ calls with a central format string. Cc: bleong@codeaurora.org Signed-off-by: Daniel Walker <dwalker@codeaurora.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c137
1 files changed, 57 insertions, 80 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7c0906367239..8d492f40cebf 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -13,7 +13,7 @@
13 * 13 *
14 */ 14 */
15 15
16#define pr_fmt(fmt) "%s:" fmt, __func__ 16#define pr_fmt(fmt) "%s: " fmt, __func__
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
@@ -116,13 +116,11 @@ static int regulator_check_voltage(struct regulator_dev *rdev,
116 BUG_ON(*min_uV > *max_uV); 116 BUG_ON(*min_uV > *max_uV);
117 117
118 if (!rdev->constraints) { 118 if (!rdev->constraints) {
119 printk(KERN_ERR "%s: no constraints for %s\n", __func__, 119 pr_err("no constraints for %s\n", rdev_get_name(rdev));
120 rdev_get_name(rdev));
121 return -ENODEV; 120 return -ENODEV;
122 } 121 }
123 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { 122 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
124 printk(KERN_ERR "%s: operation not allowed for %s\n", 123 pr_err("operation not allowed for %s\n", rdev_get_name(rdev));
125 __func__, rdev_get_name(rdev));
126 return -EPERM; 124 return -EPERM;
127 } 125 }
128 126
@@ -144,13 +142,11 @@ static int regulator_check_current_limit(struct regulator_dev *rdev,
144 BUG_ON(*min_uA > *max_uA); 142 BUG_ON(*min_uA > *max_uA);
145 143
146 if (!rdev->constraints) { 144 if (!rdev->constraints) {
147 printk(KERN_ERR "%s: no constraints for %s\n", __func__, 145 pr_err("no constraints for %s\n", rdev_get_name(rdev));
148 rdev_get_name(rdev));
149 return -ENODEV; 146 return -ENODEV;
150 } 147 }
151 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) { 148 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) {
152 printk(KERN_ERR "%s: operation not allowed for %s\n", 149 pr_err("operation not allowed for %s\n", rdev_get_name(rdev));
153 __func__, rdev_get_name(rdev));
154 return -EPERM; 150 return -EPERM;
155 } 151 }
156 152
@@ -179,18 +175,15 @@ static int regulator_check_mode(struct regulator_dev *rdev, int mode)
179 } 175 }
180 176
181 if (!rdev->constraints) { 177 if (!rdev->constraints) {
182 printk(KERN_ERR "%s: no constraints for %s\n", __func__, 178 pr_err("no constraints for %s\n", rdev_get_name(rdev));
183 rdev_get_name(rdev));
184 return -ENODEV; 179 return -ENODEV;
185 } 180 }
186 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) { 181 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) {
187 printk(KERN_ERR "%s: operation not allowed for %s\n", 182 pr_err("operation not allowed for %s\n", rdev_get_name(rdev));
188 __func__, rdev_get_name(rdev));
189 return -EPERM; 183 return -EPERM;
190 } 184 }
191 if (!(rdev->constraints->valid_modes_mask & mode)) { 185 if (!(rdev->constraints->valid_modes_mask & mode)) {
192 printk(KERN_ERR "%s: invalid mode %x for %s\n", 186 pr_err("invalid mode %x for %s\n", mode, rdev_get_name(rdev));
193 __func__, mode, rdev_get_name(rdev));
194 return -EINVAL; 187 return -EINVAL;
195 } 188 }
196 return 0; 189 return 0;
@@ -200,13 +193,11 @@ static int regulator_check_mode(struct regulator_dev *rdev, int mode)
200static int regulator_check_drms(struct regulator_dev *rdev) 193static int regulator_check_drms(struct regulator_dev *rdev)
201{ 194{
202 if (!rdev->constraints) { 195 if (!rdev->constraints) {
203 printk(KERN_ERR "%s: no constraints for %s\n", __func__, 196 pr_err("no constraints for %s\n", rdev_get_name(rdev));
204 rdev_get_name(rdev));
205 return -ENODEV; 197 return -ENODEV;
206 } 198 }
207 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) { 199 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) {
208 printk(KERN_ERR "%s: operation not allowed for %s\n", 200 pr_err("operation not allowed for %s\n", rdev_get_name(rdev));
209 __func__, rdev_get_name(rdev));
210 return -EPERM; 201 return -EPERM;
211 } 202 }
212 return 0; 203 return 0;
@@ -603,20 +594,18 @@ static int suspend_set_state(struct regulator_dev *rdev,
603 */ 594 */
604 if (!rstate->enabled && !rstate->disabled) { 595 if (!rstate->enabled && !rstate->disabled) {
605 if (can_set_state) 596 if (can_set_state)
606 printk(KERN_WARNING "%s: No configuration for %s\n", 597 pr_warning("No configuration for %s\n",
607 __func__, rdev_get_name(rdev)); 598 rdev_get_name(rdev));
608 return 0; 599 return 0;
609 } 600 }
610 601
611 if (rstate->enabled && rstate->disabled) { 602 if (rstate->enabled && rstate->disabled) {
612 printk(KERN_ERR "%s: invalid configuration for %s\n", 603 pr_err("invalid configuration for %s\n", rdev_get_name(rdev));
613 __func__, rdev_get_name(rdev));
614 return -EINVAL; 604 return -EINVAL;
615 } 605 }
616 606
617 if (!can_set_state) { 607 if (!can_set_state) {
618 printk(KERN_ERR "%s: no way to set suspend state\n", 608 pr_err("no way to set suspend state\n");
619 __func__);
620 return -EINVAL; 609 return -EINVAL;
621 } 610 }
622 611
@@ -625,15 +614,14 @@ static int suspend_set_state(struct regulator_dev *rdev,
625 else 614 else
626 ret = rdev->desc->ops->set_suspend_disable(rdev); 615 ret = rdev->desc->ops->set_suspend_disable(rdev);
627 if (ret < 0) { 616 if (ret < 0) {
628 printk(KERN_ERR "%s: failed to enabled/disable\n", __func__); 617 pr_err("failed to enabled/disable\n");
629 return ret; 618 return ret;
630 } 619 }
631 620
632 if (rdev->desc->ops->set_suspend_voltage && rstate->uV > 0) { 621 if (rdev->desc->ops->set_suspend_voltage && rstate->uV > 0) {
633 ret = rdev->desc->ops->set_suspend_voltage(rdev, rstate->uV); 622 ret = rdev->desc->ops->set_suspend_voltage(rdev, rstate->uV);
634 if (ret < 0) { 623 if (ret < 0) {
635 printk(KERN_ERR "%s: failed to set voltage\n", 624 pr_err("failed to set voltage\n");
636 __func__);
637 return ret; 625 return ret;
638 } 626 }
639 } 627 }
@@ -641,7 +629,7 @@ static int suspend_set_state(struct regulator_dev *rdev,
641 if (rdev->desc->ops->set_suspend_mode && rstate->mode > 0) { 629 if (rdev->desc->ops->set_suspend_mode && rstate->mode > 0) {
642 ret = rdev->desc->ops->set_suspend_mode(rdev, rstate->mode); 630 ret = rdev->desc->ops->set_suspend_mode(rdev, rstate->mode);
643 if (ret < 0) { 631 if (ret < 0) {
644 printk(KERN_ERR "%s: failed to set mode\n", __func__); 632 pr_err("failed to set mode\n");
645 return ret; 633 return ret;
646 } 634 }
647 } 635 }
@@ -739,9 +727,8 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
739 rdev->constraints->max_uV, 727 rdev->constraints->max_uV,
740 &selector); 728 &selector);
741 if (ret < 0) { 729 if (ret < 0) {
742 printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n", 730 pr_err("failed to apply %duV constraint to %s\n",
743 __func__, 731 rdev->constraints->min_uV, name);
744 rdev->constraints->min_uV, name);
745 rdev->constraints = NULL; 732 rdev->constraints = NULL;
746 return ret; 733 return ret;
747 } 734 }
@@ -848,8 +835,8 @@ static int set_machine_constraints(struct regulator_dev *rdev,
848 if (constraints->initial_state) { 835 if (constraints->initial_state) {
849 ret = suspend_prepare(rdev, constraints->initial_state); 836 ret = suspend_prepare(rdev, constraints->initial_state);
850 if (ret < 0) { 837 if (ret < 0) {
851 printk(KERN_ERR "%s: failed to set suspend state for %s\n", 838 pr_err("failed to set suspend state for %s\n",
852 __func__, name); 839 name);
853 rdev->constraints = NULL; 840 rdev->constraints = NULL;
854 goto out; 841 goto out;
855 } 842 }
@@ -857,17 +844,16 @@ static int set_machine_constraints(struct regulator_dev *rdev,
857 844
858 if (constraints->initial_mode) { 845 if (constraints->initial_mode) {
859 if (!ops->set_mode) { 846 if (!ops->set_mode) {
860 printk(KERN_ERR "%s: no set_mode operation for %s\n", 847 pr_err("no set_mode operation for %s\n",
861 __func__, name); 848 name);
862 ret = -EINVAL; 849 ret = -EINVAL;
863 goto out; 850 goto out;
864 } 851 }
865 852
866 ret = ops->set_mode(rdev, constraints->initial_mode); 853 ret = ops->set_mode(rdev, constraints->initial_mode);
867 if (ret < 0) { 854 if (ret < 0) {
868 printk(KERN_ERR 855 pr_err("failed to set initial mode for %s: %d\n",
869 "%s: failed to set initial mode for %s: %d\n", 856 name, ret);
870 __func__, name, ret);
871 goto out; 857 goto out;
872 } 858 }
873 } 859 }
@@ -878,8 +864,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
878 if ((constraints->always_on || constraints->boot_on) && ops->enable) { 864 if ((constraints->always_on || constraints->boot_on) && ops->enable) {
879 ret = ops->enable(rdev); 865 ret = ops->enable(rdev);
880 if (ret < 0) { 866 if (ret < 0) {
881 printk(KERN_ERR "%s: failed to enable %s\n", 867 pr_err("failed to enable %s\n", name);
882 __func__, name);
883 rdev->constraints = NULL; 868 rdev->constraints = NULL;
884 goto out; 869 goto out;
885 } 870 }
@@ -907,9 +892,8 @@ static int set_supply(struct regulator_dev *rdev,
907 err = sysfs_create_link(&rdev->dev.kobj, &supply_rdev->dev.kobj, 892 err = sysfs_create_link(&rdev->dev.kobj, &supply_rdev->dev.kobj,
908 "supply"); 893 "supply");
909 if (err) { 894 if (err) {
910 printk(KERN_ERR 895 pr_err("could not add device link %s err %d\n",
911 "%s: could not add device link %s err %d\n", 896 supply_rdev->dev.kobj.name, err);
912 __func__, supply_rdev->dev.kobj.name, err);
913 goto out; 897 goto out;
914 } 898 }
915 rdev->supply = supply_rdev; 899 rdev->supply = supply_rdev;
@@ -1039,8 +1023,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
1039 regulator->dev_attr.show = device_requested_uA_show; 1023 regulator->dev_attr.show = device_requested_uA_show;
1040 err = device_create_file(dev, &regulator->dev_attr); 1024 err = device_create_file(dev, &regulator->dev_attr);
1041 if (err < 0) { 1025 if (err < 0) {
1042 printk(KERN_WARNING "%s: could not add regulator_dev" 1026 pr_warning("could not add regulator_dev"
1043 " load sysfs\n", __func__); 1027 " requested microamps sysfs entry\n");
1044 goto attr_name_err; 1028 goto attr_name_err;
1045 } 1029 }
1046 1030
@@ -1057,9 +1041,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
1057 err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj, 1041 err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj,
1058 buf); 1042 buf);
1059 if (err) { 1043 if (err) {
1060 printk(KERN_WARNING 1044 pr_warning("could not add device link %s err %d\n",
1061 "%s: could not add device link %s err %d\n", 1045 dev->kobj.name, err);
1062 __func__, dev->kobj.name, err);
1063 goto link_name_err; 1046 goto link_name_err;
1064 } 1047 }
1065 } 1048 }
@@ -1096,7 +1079,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
1096 int ret; 1079 int ret;
1097 1080
1098 if (id == NULL) { 1081 if (id == NULL) {
1099 printk(KERN_ERR "regulator: get() with no identifier\n"); 1082 pr_err("regulator: get() with no identifier\n");
1100 return regulator; 1083 return regulator;
1101 } 1084 }
1102 1085
@@ -1282,8 +1265,8 @@ static int _regulator_enable(struct regulator_dev *rdev)
1282 ret = _regulator_enable(rdev->supply); 1265 ret = _regulator_enable(rdev->supply);
1283 mutex_unlock(&rdev->supply->mutex); 1266 mutex_unlock(&rdev->supply->mutex);
1284 if (ret < 0) { 1267 if (ret < 0) {
1285 printk(KERN_ERR "%s: failed to enable %s: %d\n", 1268 pr_err("failed to enable %s: %d\n",
1286 __func__, rdev_get_name(rdev), ret); 1269 rdev_get_name(rdev), ret);
1287 return ret; 1270 return ret;
1288 } 1271 }
1289 } 1272 }
@@ -1310,10 +1293,9 @@ static int _regulator_enable(struct regulator_dev *rdev)
1310 if (ret >= 0) { 1293 if (ret >= 0) {
1311 delay = ret; 1294 delay = ret;
1312 } else { 1295 } else {
1313 printk(KERN_WARNING 1296 pr_warning("enable_time() failed for %s: %d\n",
1314 "%s: enable_time() failed for %s: %d\n", 1297 rdev_get_name(rdev),
1315 __func__, rdev_get_name(rdev), 1298 ret);
1316 ret);
1317 delay = 0; 1299 delay = 0;
1318 } 1300 }
1319 1301
@@ -1338,8 +1320,8 @@ static int _regulator_enable(struct regulator_dev *rdev)
1338 trace_regulator_enable_complete(rdev_get_name(rdev)); 1320 trace_regulator_enable_complete(rdev_get_name(rdev));
1339 1321
1340 } else if (ret < 0) { 1322 } else if (ret < 0) {
1341 printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n", 1323 pr_err("is_enabled() failed for %s: %d\n",
1342 __func__, rdev_get_name(rdev), ret); 1324 rdev_get_name(rdev), ret);
1343 return ret; 1325 return ret;
1344 } 1326 }
1345 /* Fallthrough on positive return values - already enabled */ 1327 /* Fallthrough on positive return values - already enabled */
@@ -1396,8 +1378,8 @@ static int _regulator_disable(struct regulator_dev *rdev,
1396 1378
1397 ret = rdev->desc->ops->disable(rdev); 1379 ret = rdev->desc->ops->disable(rdev);
1398 if (ret < 0) { 1380 if (ret < 0) {
1399 printk(KERN_ERR "%s: failed to disable %s\n", 1381 pr_err("failed to disable %s\n",
1400 __func__, rdev_get_name(rdev)); 1382 rdev_get_name(rdev));
1401 return ret; 1383 return ret;
1402 } 1384 }
1403 1385
@@ -1469,8 +1451,8 @@ static int _regulator_force_disable(struct regulator_dev *rdev,
1469 /* ah well, who wants to live forever... */ 1451 /* ah well, who wants to live forever... */
1470 ret = rdev->desc->ops->disable(rdev); 1452 ret = rdev->desc->ops->disable(rdev);
1471 if (ret < 0) { 1453 if (ret < 0) {
1472 printk(KERN_ERR "%s: failed to force disable %s\n", 1454 pr_err("failed to force disable %s\n",
1473 __func__, rdev_get_name(rdev)); 1455 rdev_get_name(rdev));
1474 return ret; 1456 return ret;
1475 } 1457 }
1476 /* notify other consumers that power has been forced off */ 1458 /* notify other consumers that power has been forced off */
@@ -1911,8 +1893,8 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1911 /* get output voltage */ 1893 /* get output voltage */
1912 output_uV = rdev->desc->ops->get_voltage(rdev); 1894 output_uV = rdev->desc->ops->get_voltage(rdev);
1913 if (output_uV <= 0) { 1895 if (output_uV <= 0) {
1914 printk(KERN_ERR "%s: invalid output voltage found for %s\n", 1896 pr_err("invalid output voltage found for %s\n",
1915 __func__, rdev_get_name(rdev)); 1897 rdev_get_name(rdev));
1916 goto out; 1898 goto out;
1917 } 1899 }
1918 1900
@@ -1922,8 +1904,8 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1922 else 1904 else
1923 input_uV = rdev->constraints->input_uV; 1905 input_uV = rdev->constraints->input_uV;
1924 if (input_uV <= 0) { 1906 if (input_uV <= 0) {
1925 printk(KERN_ERR "%s: invalid input voltage found for %s\n", 1907 pr_err("invalid input voltage found for %s\n",
1926 __func__, rdev_get_name(rdev)); 1908 rdev_get_name(rdev));
1927 goto out; 1909 goto out;
1928 } 1910 }
1929 1911
@@ -1936,16 +1918,16 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1936 total_uA_load); 1918 total_uA_load);
1937 ret = regulator_check_mode(rdev, mode); 1919 ret = regulator_check_mode(rdev, mode);
1938 if (ret < 0) { 1920 if (ret < 0) {
1939 printk(KERN_ERR "%s: failed to get optimum mode for %s @" 1921 pr_err("failed to get optimum mode for %s @"
1940 " %d uA %d -> %d uV\n", __func__, rdev_get_name(rdev), 1922 " %d uA %d -> %d uV\n", rdev_get_name(rdev),
1941 total_uA_load, input_uV, output_uV); 1923 total_uA_load, input_uV, output_uV);
1942 goto out; 1924 goto out;
1943 } 1925 }
1944 1926
1945 ret = rdev->desc->ops->set_mode(rdev, mode); 1927 ret = rdev->desc->ops->set_mode(rdev, mode);
1946 if (ret < 0) { 1928 if (ret < 0) {
1947 printk(KERN_ERR "%s: failed to set optimum mode %x for %s\n", 1929 pr_err("failed to set optimum mode %x for %s\n",
1948 __func__, mode, rdev_get_name(rdev)); 1930 mode, rdev_get_name(rdev));
1949 goto out; 1931 goto out;
1950 } 1932 }
1951 ret = mode; 1933 ret = mode;
@@ -2494,8 +2476,7 @@ int regulator_suspend_prepare(suspend_state_t state)
2494 mutex_unlock(&rdev->mutex); 2476 mutex_unlock(&rdev->mutex);
2495 2477
2496 if (ret < 0) { 2478 if (ret < 0) {
2497 printk(KERN_ERR "%s: failed to prepare %s\n", 2479 pr_err("failed to prepare %s\n", rdev_get_name(rdev));
2498 __func__, rdev_get_name(rdev));
2499 goto out; 2480 goto out;
2500 } 2481 }
2501 } 2482 }
@@ -2653,13 +2634,10 @@ static int __init regulator_init_complete(void)
2653 if (has_full_constraints) { 2634 if (has_full_constraints) {
2654 /* We log since this may kill the system if it 2635 /* We log since this may kill the system if it
2655 * goes wrong. */ 2636 * goes wrong. */
2656 printk(KERN_INFO "%s: disabling %s\n", 2637 pr_info("disabling %s\n", name);
2657 __func__, name);
2658 ret = ops->disable(rdev); 2638 ret = ops->disable(rdev);
2659 if (ret != 0) { 2639 if (ret != 0) {
2660 printk(KERN_ERR 2640 pr_err("couldn't disable %s: %d\n", name, ret);
2661 "%s: couldn't disable %s: %d\n",
2662 __func__, name, ret);
2663 } 2641 }
2664 } else { 2642 } else {
2665 /* The intention is that in future we will 2643 /* The intention is that in future we will
@@ -2667,9 +2645,8 @@ static int __init regulator_init_complete(void)
2667 * so warn even if we aren't going to do 2645 * so warn even if we aren't going to do
2668 * anything here. 2646 * anything here.
2669 */ 2647 */
2670 printk(KERN_WARNING 2648 pr_warning("incomplete constraints, leaving %s on\n",
2671 "%s: incomplete constraints, leaving %s on\n", 2649 name);
2672 __func__, name);
2673 } 2650 }
2674 2651
2675unlock: 2652unlock: