Re: [RFC] regmap: Add regmap_field APIs
From: Mark Brown
Date: Wed Jun 05 2013 - 07:42:06 EST
On Wed, Jun 05, 2013 at 10:21:23AM +0100, Srinivas KANDAGATLA wrote:
> Is it ok if we rename the regmap_field_init function to
> regmap_field_alloc, as it will make it obvious that its allocating
> memory which should be freed?
> I also thought we could add devm version of it as well.
Yes, that's all sensible.
> With this change here is what the init/alloc function would look like:
> static void _regmap_field_init(struct regmap_field *field,
> struct regmap *regmap, unsigned int reg,
> unsigned int lsb, unsigned int msb)
> struct regmap_field *devm_regmap_field_alloc(struct device *dev,
> struct regmap *regmap, unsigned int reg,
> unsigned int lsb, unsigned int msb)
I think I'd prefer to see a struct passed in here for the field
definition - this would make it easier to initialise from static data,
otherwise people will end up writing a loop that reads from a locally
defined struct once they get more than a couple of fields.
Otherwise this makes sense.
Attachment:
signature.asc
Description: Digital signature