From: gshark <gshark.jeong@gmail.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Bryan Wu <bryan.wu@canonical.com>,
Richard Purdie <rpurdie@rpsys.net>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
Date: Mon, 24 Sep 2012 09:58:04 +0900 [thread overview]
Message-ID: <505FB01C.4060905@gmail.com> (raw)
In-Reply-To: <1348296014.12906.2.camel@phoenix>
2012년 09월 22일 15:40, Axel Lin 쓴 글:
> Use regmap_update_bits() to replace regmap_read() + regmap_write().
> With this patch, we only show the error message when regmap_update_bits()
> fails.
Looks good..You're right. Thank you Alex.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: G.Shark Jeong<gshark.jeong@gmail.com>
> ---
> drivers/leds/leds-lm3642.c | 15 +++------------
> 1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c
> index 924853b..3285006 100644
> --- a/drivers/leds/leds-lm3642.c
> +++ b/drivers/leds/leds-lm3642.c
> @@ -95,23 +95,14 @@ struct lm3642_chip_data {
> /* chip initialize */
> static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip)
> {
> - unsigned int reg_val;
> int ret;
> struct lm3642_platform_data *pdata = chip->pdata;
>
> /* set enable register */
> - ret = regmap_read(chip->regmap, REG_ENABLE, ®_val);
> + ret = regmap_update_bits(chip->regmap, REG_ENABLE, EX_PIN_ENABLE_MASK,
> + pdata->tx_pin);
> if (ret < 0)
> - goto out;
> -
> - reg_val &= (~EX_PIN_ENABLE_MASK);
> - reg_val |= pdata->tx_pin;
> - ret = regmap_write(chip->regmap, REG_ENABLE, reg_val);
> - if (ret < 0)
> - goto out;
> -
> -out:
> - dev_err(chip->dev, "Failed to read REG_ENABLE Register\n");
> + dev_err(chip->dev, "Failed to update REG_ENABLE Register\n");
> return ret;
> }
>
next prev parent reply other threads:[~2012-09-24 0:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-22 6:40 [PATCH] leds: lm3642: Use regmap_update_bits() in lm3642_chip_init() Axel Lin
2012-09-24 0:58 ` gshark [this message]
2012-09-24 11:11 ` Bryan Wu
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=505FB01C.4060905@gmail.com \
--to=gshark.jeong@gmail.com \
--cc=axel.lin@ingics.com \
--cc=bryan.wu@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/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.