All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Sangbeom Kim <sbkim73@samsung.com>
Cc: sameo@linux.intel.com, lrg@ti.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/5] regulator: Add S5M8767 regulator driver
Date: Mon, 26 Dec 2011 11:26:06 +0000	[thread overview]
Message-ID: <20111226112605.GD8722@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1324628892-12170-5-git-send-email-sbkim73@samsung.com>

On Fri, Dec 23, 2011 at 05:28:11PM +0900, Sangbeom Kim wrote:

> +	ret = s5m_reg_read(s5m8767->iodev, reg, &val);
> +	if (ret)
> +		return ret;
> +
> +	val &= mask;
> +
> +	if (rdev->desc && rdev->desc->ops && rdev->desc->ops->list_voltage)
> +		return rdev->desc->ops->list_voltage(rdev, val);
> +
> +	return s5m8767_list_voltage(rdev, val);

This looks really weird, I'm not sure why you're looking directly in the
descriptor.  In any case, just implement get_voltage_sel() rather than
plain get_voltage() and the core will do the lookup for you.

> +	s5m_reg_read(s5m8767->iodev, reg, &val);
> +	val = val & mask;
> +
> +	ret = s5m_reg_update(s5m8767->iodev, reg, i, mask);
> +	*selector = i;

This looks odd - shouldn't reg_update() already be masking things for
you.

> +
> +	if (val < i){
> +		udelay(DIV_ROUND_UP(desc->step * (i - val),
> +			s5m8767->ramp_delay));
> +	}

You should implement set_voltage_time_sel() and drop this, the core will
add the delay for you.

Also note the odd indentation and whitespace with a lot of this code.

> +	case S5M8767_BUCK2:
> +		if(s5m8767->buck2_gpiodvs){
> +			while ( s5m8767->buck2_vol[i] != new_val )
> +				i++;

This has some of the other odd whitespace - not enough spaces on the
line with the if () but extras inside the () on the while.

> +	s5m8767 = kzalloc(sizeof(struct s5m8767_info), GFP_KERNEL);
> +	if (!s5m8767)
> +		return -ENOMEM;

devm_kzalloc().

> +	size = sizeof(struct regulator_dev *) * pdata->num_regulators;

Just have fixed size arrays for the regulators and always register them
- it's less error prone and makes the code simpler.

  reply	other threads:[~2011-12-26 11:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-23  8:28 [PATCH v2 0/5] Samsung S5M series initial release Sangbeom Kim
2011-12-23  8:28 ` [PATCH v2 1/5] mfd: Add S5M core driver Sangbeom Kim
2011-12-24 18:41   ` Mark Brown
2012-01-08 23:10   ` Samuel Ortiz
2011-12-23  8:28 ` [PATCH v2 2/5] mfd: Add s5m series irq driver Sangbeom Kim
2011-12-24 18:54   ` Mark Brown
2012-01-08 23:11   ` Samuel Ortiz
2011-12-23  8:28 ` [PATCH v3 3/5] mfd: Add S5M series configuration Sangbeom Kim
2012-01-08 23:12   ` Samuel Ortiz
2011-12-23  8:28 ` [PATCH v2 4/5] regulator: Add S5M8767 regulator driver Sangbeom Kim
2011-12-26 11:26   ` Mark Brown [this message]
2011-12-23  8:28 ` [PATCH v2 5/5] regulator: Add S5M8767 configuration Sangbeom Kim

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=20111226112605.GD8722@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=sameo@linux.intel.com \
    --cc=sbkim73@samsung.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.