public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: sameo@linux.intel.com, myungjoo.ham@samsung.com,
	kyungmin.park@samsung.com, jonghwa3.lee@samsung.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] MFD: MAX77693: add MAX77693 MFD driver
Date: Mon, 14 May 2012 10:19:18 +0100	[thread overview]
Message-ID: <20120514091917.GJ31985@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1336972830-15169-1-git-send-email-cw00.choi@samsung.com>

[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]

On Mon, May 14, 2012 at 02:20:30PM +0900, Chanwoo Choi wrote:

> Signef-off-by: Chanwoo Choi <cw00.choi@samsung.com>

Typo :)

> +int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest)
> +{
> +	unsigned int val;
> +	int ret;
> +
> +	ret = regmap_read(map, reg, &val);
> +	val &= 0xff;
> +	*dest = val;

Should be no need for the val &= 0xff - if there is there's a bug we
ought to fix in regmap.

> +int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask)
> +{
> +	unsigned int old_val, new_val;
> +	int ret;
> +
> +	ret = regmap_read(map, reg, &old_val);
> +	old_val &= 0xff;
> +	new_val = (val & mask) | (old_val & (~mask));
> +	ret = regmap_write(map, reg, new_val);

This should be using regmap_update_bits(), the current code is buggy as
it does not lock which means that multiple simultaneous updaters could
conflict with each other.

> +static struct regmap_config max77693_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,

Defining max_register would let you see the register map in debugfs but
this is optional.

> +	max77693->regmap = regmap_init_i2c(i2c, &max77693_regmap_config);
> +	if (IS_ERR(max77693->regmap)) {

devm_regmap_init_i2c().

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-05-14  9:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14  5:20 [PATCH v3 1/2] MFD: MAX77693: add MAX77693 MFD driver Chanwoo Choi
2012-05-14  9:19 ` Mark Brown [this message]
2012-05-14 10:08   ` Chanwoo Choi

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=20120514091917.GJ31985@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=cw00.choi@samsung.com \
    --cc=jonghwa3.lee@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.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