lkml.org 
[lkml]   [2013]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] regmap: Add regmap_field APIs
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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-06-05 14:21    [W:0.077 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site