lkml.org 
[lkml]   [2013]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] regmap: Add regmap_field APIs
On 09/06/13 17:00, 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
It makes sense, I will do that change.

Thanks,
srini
>
>> +}
>> +EXPORT_SYMBOL_GPL(regmap_field_write);



\
 
 \ /
  Last update: 2013-06-10 09:41    [W:0.587 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site