Re: [RFC] regmap: Add regmap_field APIs
From: Mark Brown
Date: Tue Jun 04 2013 - 17:02:26 EST
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.
Attachment:
signature.asc
Description: Digital signature