All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Linus Walleij <linus.walleij@stericsson.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>,
	linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Samuel Ortiz <samuel.ortiz@intel.com>,
	Ola Lilja <ola.o.lilja@stericsson.com>
Subject: Re: [PATCH 2/3] regulator: add a subdriver for TI TPS6105x regulator portions
Date: Tue, 8 Mar 2011 11:56:40 +0000	[thread overview]
Message-ID: <20110308115640.GC20944@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1299577320-31389-1-git-send-email-linus.walleij@stericsson.com>

On Tue, Mar 08, 2011 at 10:42:00AM +0100, Linus Walleij wrote:

> +static int tps6105x_regulator_get_voltage(struct regulator_dev *rdev)
> +{

It'd probably simplify things to use the _sel variants for the voltage
operations.

> +static int __devinit tps6105x_regulator_probe(struct platform_device *pdev)
> +{
> +	struct tps6105x *tps6105x = platform_get_drvdata(pdev);
> +	struct tps6105x_platform_data *pdata = tps6105x->pdata;
> +	int ret;
> +
> +	/* This instance is not set for regulator mode so bail out */
> +	if (pdata->mode != TPS6105X_MODE_VOLTAGE)
> +		return 0;

-ENODEV?  Logging to explain why we're bombing out might be helpful too.

> +	/* Set lowest voltage 4.5V to begin */
> +	ret = tps6105x_mask_and_set(tps6105x, TPS6105X_REG_0,
> +		TPS6105X_REG0_VOLTAGE_MASK,
> +		TPS6105X_REG0_VOLTAGE_450 << TPS6105X_REG0_VOLTAGE_SHIFT);
> +	if (ret)
> +		return ret;

Don't do this, if the user wants to set a defualt voltage they can use
constraints but if the driver does it then it may disrupt a running
system.

> +#if 0
> +	/* Activate voltage mode - use to check if voltage comes out */
> +	ret = tps6105x_mask_and_set(tps6105x, TPS6105X_REG_0,
> +		TPS6105X_REG0_MODE_MASK,
> +		TPS6105X_REG0_MODE_VOLTAGE << TPS6105X_REG0_MODE_SHIFT);
> +	if (ret)
> +		return ret;
> +#endif

Don't include if 0 code.

> +subsys_initcall(tps6105x_regulator_init);
> +module_exit(tps6105x_regulator_exit);

These usually go next to the functions.

  reply	other threads:[~2011-03-08 11:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08  9:42 [PATCH 2/3] regulator: add a subdriver for TI TPS6105x regulator portions Linus Walleij
2011-03-08 11:56 ` Mark Brown [this message]
2011-03-08 13:26   ` Linus Walleij
2011-03-08 13:29     ` Mark Brown
2011-03-08 13:34       ` Linus Walleij

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=20110308115640.GC20944@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=ola.o.lilja@stericsson.com \
    --cc=samuel.ortiz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.