Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Rongjun Ying <rongjun.ying@csr.com>,
	Barry Song <baohua@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH] ASoC: sirf-audio-codec: Simplify the new bitmask value in regmap_update_bits
Date: Thu, 08 May 2014 16:31:40 +0800	[thread overview]
Message-ID: <1399537900.21710.2.camel@phoenix> (raw)
In-Reply-To: <1399537789.21710.1.camel@phoenix>

On 四, 2014-05-08 at 16:29 +0800, Axel Lin wrote:
> Having the binary ones complement operator in the new bitmak value makes the
> code hard to read.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> I think the binary ones complement operator in such use case is error prone:
> For example:
> To set BIT(1) and clear both BIT(2) and BIT(3):
> The following code has wrong result:
> regmap_update_bits(regmap, the_register, BIT(1), BIT(2), BIT(3),
>                    BIT(1) | ~BIT(2) | ~BIT(3));
Oops, I mean:
regmap_update_bits(regmap, the_register, BIT(1) | BIT(2)| BIT(3),
                   BIT(1) | ~BIT(2) | ~BIT(3));
Axel

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2014-05-08  8:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08  8:29 [PATCH] ASoC: sirf-audio-codec: Simplify the new bitmask value in regmap_update_bits Axel Lin
2014-05-08  8:31 ` Axel Lin [this message]
2014-05-26 16:00 ` Mark Brown

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=1399537900.21710.2.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=baohua@kernel.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=rongjun.ying@csr.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