All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas KANDAGATLA <srinivas.kandagatla@st.com>
To: Mark Brown <broonie@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] regmap: Add regmap_field APIs
Date: Mon, 10 Jun 2013 11:27:41 +0100	[thread overview]
Message-ID: <51B5AA1D.8010408@st.com> (raw)
In-Reply-To: <20130610091539.GG31367@sirena.org.uk>

On 10/06/13 10:15, Mark Brown wrote:
> On Sun, Jun 09, 2013 at 06:00:19PM +0200, Lars-Peter Clausen wrote:
> 
>>> +int regmap_field_write(struct regmap_field *field, unsigned int val)
>>> +{
>>> +	int field_bits;
>>> +	unsigned int reg_mask;
>>> +	field_bits = field->msb - field->lsb + 1;
>>> +	reg_mask = ((BIT(field_bits) - 1) << field->lsb);
>>> +	return regmap_update_bits(field->regmap, field->reg,
>>> +				reg_mask, val << field->lsb);
> 
>> Considering that you'd do the same calculations over and over again it would
>> probably make more sense store the mask rather than the msb in the struct
> 
> However as an interface for registering either is OK - the current
> MSB/LSB approach is probably better as that's what datasheets tend to
> include (which is why I didn't say anything).

regmap field interface still will be of lsb/msb style, However, As Lars
said, the internal data structure which holds these info can have mask
field rather than storing lsb/msb info.
I just posted a V2 patch with your review comments. I did not read your
response before I hit the send button.


      reply	other threads:[~2013-06-10 10:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 14:58 [RFC] regmap: Add regmap_field APIs Srinivas KANDAGATLA
2013-05-31  6:31 ` Srinivas KANDAGATLA
2013-06-01 18:38   ` Mark Brown
2013-06-04 21:01 ` Mark Brown
2013-06-05  9:21   ` Srinivas KANDAGATLA
2013-06-05 11:41     ` Mark Brown
2013-06-05 14:41       ` Srinivas KANDAGATLA
2013-06-05 15:59         ` Mark Brown
2013-06-09 16:00 ` Lars-Peter Clausen
2013-06-10  7:09   ` Srinivas KANDAGATLA
2013-06-10  9:15   ` Mark Brown
2013-06-10 10:27     ` Srinivas KANDAGATLA [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=51B5AA1D.8010408@st.com \
    --to=srinivas.kandagatla@st.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@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 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.