diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-02-29 20:26:27 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-11 16:48:46 -0400 |
commit | b3e1348e2753a8c8d17e620ae79ce0c9fa43f40c (patch) | |
tree | aeeb4bd5a5c46a15c2511b8973b2a778bc17c0b4 /drivers/regulator/max8997.c | |
parent | ba51c6c022b64b7f3f68d7e2936a37f6ffbc7c4d (diff) |
regulator: Kill max8997_get_rid function
Use rdev_get_id() directly.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r-- | drivers/regulator/max8997.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index bb7cd9df9487..96579296f04d 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -130,15 +130,10 @@ static const struct voltage_map_desc *reg_voltage_map[] = { | |||
130 | [MAX8997_CHARGER_TOPOFF] = &topoff_current_map_desc, | 130 | [MAX8997_CHARGER_TOPOFF] = &topoff_current_map_desc, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | static inline int max8997_get_rid(struct regulator_dev *rdev) | ||
134 | { | ||
135 | return rdev_get_id(rdev); | ||
136 | } | ||
137 | |||
138 | static int max8997_list_voltage_safeout(struct regulator_dev *rdev, | 133 | static int max8997_list_voltage_safeout(struct regulator_dev *rdev, |
139 | unsigned int selector) | 134 | unsigned int selector) |
140 | { | 135 | { |
141 | int rid = max8997_get_rid(rdev); | 136 | int rid = rdev_get_id(rdev); |
142 | 137 | ||
143 | if (rid == MAX8997_ESAFEOUT1 || rid == MAX8997_ESAFEOUT2) { | 138 | if (rid == MAX8997_ESAFEOUT1 || rid == MAX8997_ESAFEOUT2) { |
144 | switch (selector) { | 139 | switch (selector) { |
@@ -161,7 +156,7 @@ static int max8997_list_voltage_safeout(struct regulator_dev *rdev, | |||
161 | static int max8997_list_voltage_charger_cv(struct regulator_dev *rdev, | 156 | static int max8997_list_voltage_charger_cv(struct regulator_dev *rdev, |
162 | unsigned int selector) | 157 | unsigned int selector) |
163 | { | 158 | { |
164 | int rid = max8997_get_rid(rdev); | 159 | int rid = rdev_get_id(rdev); |
165 | 160 | ||
166 | if (rid != MAX8997_CHARGER_CV) | 161 | if (rid != MAX8997_CHARGER_CV) |
167 | goto err; | 162 | goto err; |
@@ -184,7 +179,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev, | |||
184 | unsigned int selector) | 179 | unsigned int selector) |
185 | { | 180 | { |
186 | const struct voltage_map_desc *desc; | 181 | const struct voltage_map_desc *desc; |
187 | int rid = max8997_get_rid(rdev); | 182 | int rid = rdev_get_id(rdev); |
188 | int val; | 183 | int val; |
189 | 184 | ||
190 | if (rid >= ARRAY_SIZE(reg_voltage_map) || | 185 | if (rid >= ARRAY_SIZE(reg_voltage_map) || |
@@ -205,7 +200,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev, | |||
205 | static int max8997_get_enable_register(struct regulator_dev *rdev, | 200 | static int max8997_get_enable_register(struct regulator_dev *rdev, |
206 | int *reg, int *mask, int *pattern) | 201 | int *reg, int *mask, int *pattern) |
207 | { | 202 | { |
208 | int rid = max8997_get_rid(rdev); | 203 | int rid = rdev_get_id(rdev); |
209 | 204 | ||
210 | switch (rid) { | 205 | switch (rid) { |
211 | case MAX8997_LDO1 ... MAX8997_LDO21: | 206 | case MAX8997_LDO1 ... MAX8997_LDO21: |
@@ -325,7 +320,7 @@ static int max8997_reg_disable(struct regulator_dev *rdev) | |||
325 | static int max8997_get_voltage_register(struct regulator_dev *rdev, | 320 | static int max8997_get_voltage_register(struct regulator_dev *rdev, |
326 | int *_reg, int *_shift, int *_mask) | 321 | int *_reg, int *_shift, int *_mask) |
327 | { | 322 | { |
328 | int rid = max8997_get_rid(rdev); | 323 | int rid = rdev_get_id(rdev); |
329 | int reg, shift = 0, mask = 0x3f; | 324 | int reg, shift = 0, mask = 0x3f; |
330 | 325 | ||
331 | switch (rid) { | 326 | switch (rid) { |
@@ -386,7 +381,7 @@ static int max8997_get_voltage(struct regulator_dev *rdev) | |||
386 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); | 381 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); |
387 | struct i2c_client *i2c = max8997->iodev->i2c; | 382 | struct i2c_client *i2c = max8997->iodev->i2c; |
388 | int reg, shift, mask, ret; | 383 | int reg, shift, mask, ret; |
389 | int rid = max8997_get_rid(rdev); | 384 | int rid = rdev_get_id(rdev); |
390 | u8 val; | 385 | u8 val; |
391 | 386 | ||
392 | ret = max8997_get_voltage_register(rdev, ®, &shift, &mask); | 387 | ret = max8997_get_voltage_register(rdev, ®, &shift, &mask); |
@@ -446,7 +441,7 @@ static int max8997_set_voltage_charger_cv(struct regulator_dev *rdev, | |||
446 | { | 441 | { |
447 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); | 442 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); |
448 | struct i2c_client *i2c = max8997->iodev->i2c; | 443 | struct i2c_client *i2c = max8997->iodev->i2c; |
449 | int rid = max8997_get_rid(rdev); | 444 | int rid = rdev_get_id(rdev); |
450 | int lb, ub; | 445 | int lb, ub; |
451 | int reg, shift = 0, mask, ret = 0; | 446 | int reg, shift = 0, mask, ret = 0; |
452 | u8 val = 0x0; | 447 | u8 val = 0x0; |
@@ -503,7 +498,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev, | |||
503 | struct i2c_client *i2c = max8997->iodev->i2c; | 498 | struct i2c_client *i2c = max8997->iodev->i2c; |
504 | int min_vol = min_uV / 1000, max_vol = max_uV / 1000; | 499 | int min_vol = min_uV / 1000, max_vol = max_uV / 1000; |
505 | const struct voltage_map_desc *desc; | 500 | const struct voltage_map_desc *desc; |
506 | int rid = max8997_get_rid(rdev); | 501 | int rid = rdev_get_id(rdev); |
507 | int reg, shift = 0, mask, ret; | 502 | int reg, shift = 0, mask, ret; |
508 | int i; | 503 | int i; |
509 | u8 org; | 504 | u8 org; |
@@ -564,7 +559,7 @@ static int max8997_assess_side_effect(struct regulator_dev *rdev, | |||
564 | u8 new_val, int *best) | 559 | u8 new_val, int *best) |
565 | { | 560 | { |
566 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); | 561 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); |
567 | int rid = max8997_get_rid(rdev); | 562 | int rid = rdev_get_id(rdev); |
568 | u8 *buckx_val[3]; | 563 | u8 *buckx_val[3]; |
569 | bool buckx_gpiodvs[3]; | 564 | bool buckx_gpiodvs[3]; |
570 | int side_effect[8]; | 565 | int side_effect[8]; |
@@ -641,7 +636,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev, | |||
641 | int min_uV, int max_uV, unsigned *selector) | 636 | int min_uV, int max_uV, unsigned *selector) |
642 | { | 637 | { |
643 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); | 638 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); |
644 | int rid = max8997_get_rid(rdev); | 639 | int rid = rdev_get_id(rdev); |
645 | const struct voltage_map_desc *desc; | 640 | const struct voltage_map_desc *desc; |
646 | int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg; | 641 | int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg; |
647 | bool gpio_dvs_mode = false; | 642 | bool gpio_dvs_mode = false; |
@@ -724,7 +719,7 @@ static int max8997_set_voltage_safeout(struct regulator_dev *rdev, | |||
724 | { | 719 | { |
725 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); | 720 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); |
726 | struct i2c_client *i2c = max8997->iodev->i2c; | 721 | struct i2c_client *i2c = max8997->iodev->i2c; |
727 | int rid = max8997_get_rid(rdev); | 722 | int rid = rdev_get_id(rdev); |
728 | int reg, shift = 0, mask, ret; | 723 | int reg, shift = 0, mask, ret; |
729 | int i = 0; | 724 | int i = 0; |
730 | u8 val; | 725 | u8 val; |
@@ -766,7 +761,7 @@ static int max8997_reg_disable_suspend(struct regulator_dev *rdev) | |||
766 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); | 761 | struct max8997_data *max8997 = rdev_get_drvdata(rdev); |
767 | struct i2c_client *i2c = max8997->iodev->i2c; | 762 | struct i2c_client *i2c = max8997->iodev->i2c; |
768 | int ret, reg, mask, pattern; | 763 | int ret, reg, mask, pattern; |
769 | int rid = max8997_get_rid(rdev); | 764 | int rid = rdev_get_id(rdev); |
770 | 765 | ||
771 | ret = max8997_get_enable_register(rdev, ®, &mask, &pattern); | 766 | ret = max8997_get_enable_register(rdev, ®, &mask, &pattern); |
772 | if (ret) | 767 | if (ret) |