Re: [PATCH 2/5] regulator: tps65911: Add new chip version

From: Mark Brown
Date: Tue May 03 2011 - 13:40:55 EST


On Tue, May 03, 2011 at 11:18:49AM -0500, Jorge Eduardo Candelaria wrote:

Mostly OK - a few small things.

> + if (id == TPS65910_REG_VDD1 || id == TPS65910_REG_VDD2) {
> + dcdc_mult = (selector / VDD1_2_NUM_VOLTS) + 1;
> + if (dcdc_mult == 1) dcdc_mult--;
> + vsel = (selector % VDD1_2_NUM_VOLTS) + 3;
> + } else {
> + vsel = selector;
> + }

Things like this should be switch statements.

> - volt = VDD1_2_MIN_VOLT + (selector % VDD1_2_NUM_VOLTS) * VDD1_2_OFFSET;
> + if (id == TPS65911_REG_VDDCTRL)
> + volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET);
> + else
> + mult = (selector / VDD1_2_NUM_VOLTS) + 1;
> + volt = VDD1_2_MIN_VOLT +
> + (selector % VDD1_2_NUM_VOLTS) * VDD1_2_OFFSET;

This doesn't tie in with the equivalent change in list_voltage() since
you're testing for a different regulator (but it looks OK from a quick
scan I *think*).

> + if (tps65910_chip_id(tps65910) == TPS65910) {
> + pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
> + info = tps65910_regs;
> + } else if (tps65910_chip_id(tps65910) == TPS65911) {
> + pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
> + info = tps65911_regs;
> + } else {
> + pr_err("Invalid tps chip version\n");
> + return -ENODEV;
> + }

switch statement.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/