public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Cc: linux-kernel@vger.kernel.org, sameo@linux.intel.com, lrg@ti.com,
	Graeme Gregory <gg@slimlogic.co.uk>,
	grant.likely@secretlab.ca
Subject: Re: [PATCH 2/5] regulator: tps65911: Add new chip version
Date: Tue, 3 May 2011 18:40:48 +0100	[thread overview]
Message-ID: <20110503174048.GF1762@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <91D0C3C1-66A6-4642-8F78-EFE99236D1A7@slimlogic.co.uk>

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.

      parent reply	other threads:[~2011-05-03 17:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 16:18 [PATCH 2/5] regulator: tps65911: Add new chip version Jorge Eduardo Candelaria
2011-05-03 16:31 ` Stephen Boyd
2011-05-03 17:40 ` Mark Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110503174048.GF1762@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=gg@slimlogic.co.uk \
    --cc=grant.likely@secretlab.ca \
    --cc=jedu@slimlogic.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox