History

regulator: wm8400: Get rid of wm8400_block_read/wm8400_set_bits functions

The only user of wm8400_block_read/wm8400_set_bits functions is the wm8400 regulator driver. At the context of all the callers, we can use regmap_bulk_read/regmap_update_bits directly. Thus remove wm8400_block_read/wm8400_set_bits functions.

Axel Lin committed 7 years ago

Commit e08abec1 parent 5b60ee53 files · +8 −23Browse files

Unified · Split

3 files
  1. drivers/mfd/wm8400-core.c +0 −6
  2. drivers/regulator/wm8400-regulator.c +8 −9
  3. include/linux/mfd/wm8400-private.h +0 −8
drivers/mfd/wm8400-core.c+0−6
@@ -35,12 +35,6 @@ static bool wm8400_volatile(struct device *dev, unsigned int reg) · 34 unmodified lines
3535 }
3636 }
3737
38−int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data)
39−{
40− return regmap_bulk_read(wm8400->regmap, reg, data, count);
41−}
42−EXPORT_SYMBOL_GPL(wm8400_block_read);
43−
4438 static int wm8400_register_codec(struct wm8400 *wm8400)
4539 {
4640 const struct mfd_cell cell = {
drivers/regulator/wm8400-regulator.c+8−9
@@ -36,13 +36,12 @@ static const struct regulator_ops wm8400_ldo_ops = { · 35 unmodified lines
3636
3737 static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev)
3838 {
39− struct wm8400 *wm8400 = rdev_get_drvdata(dev);
39+ struct regmap *rmap = rdev_get_regmap(dev);
4040 int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2;
4141 u16 data[2];
4242 int ret;
4343
44− ret = wm8400_block_read(wm8400, WM8400_DCDC1_CONTROL_1 + offset, 2,
45− data);
44+ ret = regmap_bulk_read(rmap, WM8400_DCDC1_CONTROL_1 + offset, data, 2);
4645 if (ret != 0)
4746 return 0;
4847
@@ -63,36 +62,36 @@ static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev) · 14 unmodified lines
6362
6463 static int wm8400_dcdc_set_mode(struct regulator_dev *dev, unsigned int mode)
6564 {
66− struct wm8400 *wm8400 = rdev_get_drvdata(dev);
65+ struct regmap *rmap = rdev_get_regmap(dev);
6766 int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2;
6867 int ret;
6968
7069 switch (mode) {
7170 case REGULATOR_MODE_FAST:
7271 /* Datasheet: active with force PWM */
73− ret = wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_2 + offset,
72+ ret = regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_2 + offset,
7473 WM8400_DC1_FRC_PWM, WM8400_DC1_FRC_PWM);
7574 if (ret != 0)
7675 return ret;
7776
78− return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset,
77+ return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
7978 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP,
8079 WM8400_DC1_ACTIVE);
8180
8281 case REGULATOR_MODE_NORMAL:
8382 /* Datasheet: active */
84− ret = wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_2 + offset,
83+ ret = regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_2 + offset,
8584 WM8400_DC1_FRC_PWM, 0);
8685 if (ret != 0)
8786 return ret;
8887
89− return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset,
88+ return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
9089 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP,
9190 WM8400_DC1_ACTIVE);
9291
9392 case REGULATOR_MODE_IDLE:
9493 /* Datasheet: standby */
95− return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset,
94+ return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
9695 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, 0);
9796 default:
9897 return -EINVAL;
include/linux/mfd/wm8400-private.h+0−8
@@ -923,12 +923,4 @@ struct wm8400 { · 922 unmodified lines
923923 #define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */
924924 #define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */
925925
926−int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data);
927−
928−static inline int wm8400_set_bits(struct wm8400 *wm8400, u8 reg,
929− u16 mask, u16 val)
930−{
931− return regmap_update_bits(wm8400->regmap, reg, mask, val);
932−}
933−
934926 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t