Skip to content

Commit

Permalink
regulator: Remove MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_R…
Browse files Browse the repository at this point in the history
…EG_BUCK5DVS macros

In current implementation, the original macro implementation assumes the caller
pass the parameter starting from 1 (to match the register names in datasheet).
Thus we have unneeded plus one then minus one operations
when using MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros.

This patch removes these macros to avoid unneeded plus one then minus one operations
without reducing readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Axel Lin authored and Liam Girdwood committed May 27, 2011
1 parent 0514e9a commit ecb9c4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 6 additions & 6 deletions drivers/regulator/max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,11 +1032,11 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)

/* For the safety, set max voltage before setting up */
for (i = 0; i < 8; i++) {
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS(i + 1),
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i,
max_buck1, 0x3f);
max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS(i + 1),
max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS1 + i,
max_buck2, 0x3f);
max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS(i + 1),
max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS1 + i,
max_buck5, 0x3f);
}

Expand Down Expand Up @@ -1113,13 +1113,13 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)

/* Initialize all the DVS related BUCK registers */
for (i = 0; i < 8; i++) {
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS(i + 1),
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i,
max8997->buck1_vol[i],
0x3f);
max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS(i + 1),
max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS1 + i,
max8997->buck2_vol[i],
0x3f);
max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS(i + 1),
max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS1 + i,
max8997->buck5_vol[i],
0x3f);
}
Expand Down
4 changes: 0 additions & 4 deletions include/linux/mfd/max8997-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,6 @@ enum max8997_irq {
MAX8997_IRQ_NR,
};

#define MAX8997_REG_BUCK1DVS(x) (MAX8997_REG_BUCK1DVS1 + (x) - 1)
#define MAX8997_REG_BUCK2DVS(x) (MAX8997_REG_BUCK2DVS1 + (x) - 1)
#define MAX8997_REG_BUCK5DVS(x) (MAX8997_REG_BUCK5DVS1 + (x) - 1)

#define MAX8997_NUM_GPIO 12
struct max8997_dev {
struct device *dev;
Expand Down

0 comments on commit ecb9c4f

Please sign in to comment.