[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <51B5AA1D.8010408@st.com>
Date: Mon, 10 Jun 2013 11:27:41 +0100
From: Srinivas KANDAGATLA <srinivas.kandagatla@...com>
To: Mark Brown <broonie@...nel.org>
Cc: Lars-Peter Clausen <lars@...afoo.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] regmap: Add regmap_field APIs
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists