lkml.org 
[lkml]   [2013]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] regmap: Add regmap_field APIs
On Tue, May 28, 2013 at 03:58:00PM +0100, Srinivas KANDAGATLA wrote:

> +#define REGMAP_FIELD_INIT(regmap, reg, lsb, msb) { \
> + .regmap = regmap, \
> + .reg = reg, \
> + .lsb = lsb, \
> + .msb = msb, \
> + }

Having a macro for this is really odd since macros are generally only
used at compile time but the regmap is only available at runtime and
this...

> +static inline void regmap_field_init(struct regmap_field *field,
> + struct regmap *regmap, unsigned int reg,
> + unsigned int lsb, unsigned int msb)
> +{
> + field->regmap = regmap;
> + field->reg = reg;
> + field->lsb = lsb;
> + field->msb = msb;
> +}

...is a bit awkward since you can't use it with static data. I think
either the read/write/modify APIs should be changed to take both the map
and the field as arguments (with the field only containing the bitfield
definitions) or the init function should be something that allocates a
new, runtime only structure from static data.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-06-04 23:41    [W:0.113 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site