From: Andrew Morton <akpm@linux-foundation.org>
To: hvaibhav@ti.com
Cc: linux-kernel@vger.kernel.org, byron.bbradley@gmail.com,
linux-omap@vger.kernel.org, felipe.balbi@nokia.com
Subject: Re: [PATCH-V2 3/3] RTC:s35390a: Add update_irq (per Min interrupt) support
Date: Mon, 23 Aug 2010 16:43:40 -0700 [thread overview]
Message-ID: <20100823164340.562f466f.akpm@linux-foundation.org> (raw)
In-Reply-To: <1282393829-7326-4-git-send-email-hvaibhav@ti.com>
On Sat, 21 Aug 2010 18:00:29 +0530
hvaibhav@ti.com wrote:
> +static int s35390a_update_irq_enable(struct i2c_client *client,
> + unsigned enabled)
> +{
> + struct s35390a *s35390a = i2c_get_clientdata(client);
> + char buf[1];
> +
> + if (s35390a_get_reg(s35390a, S35390A_CMD_STATUS2, buf, sizeof(buf)) < 0)
> + return -EIO;
> +
> + /* This chip returns the bits of each byte in reverse order */
> + buf[0] = bitrev8(buf[0]);
> +
> + buf[0] &= ~S35390A_INT1_MODE_MASK;
> + if (enabled)
> + buf[0] |= S35390A_INT1_MODE_PMIN_STDY;
> + else
> + buf[0] |= S35390A_INT1_MODE_NOINTR;
> +
> + /* This chip expects the bits of each byte in reverse order */
> + buf[0] = bitrev8(buf[0]);
grumble. We bit-reverse it, fiddle a couple of bits and then
bit-reverse it again. Lazy.
Why not leave it bit-reversed and just bit-reverse the constants?
Extra marks are awarded for coming up with a compile-time bitrev8() ;)
> + return s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, buf, sizeof(buf));
> +}
prev parent reply other threads:[~2010-08-23 23:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-21 12:30 [PATCH-V2 3/3] RTC:s35390a: Add update_irq (per Min interrupt) support hvaibhav
2010-08-23 23:43 ` Andrew Morton [this message]
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=20100823164340.562f466f.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=byron.bbradley@gmail.com \
--cc=felipe.balbi@nokia.com \
--cc=hvaibhav@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
/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