lkml.org 
[lkml]   [2012]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] Add "no-bus" option for regmap API
On Fri, Dec 21, 2012 at 01:47:18AM -0800, Andrey Smirnov wrote:

This looks really good, the issues and questions I have below are pretty
detailed.

> - int (*reg_read)(struct regmap *map, unsigned int reg, unsigned int *val);
> - int (*reg_write)(struct regmap *map, unsigned int reg, unsigned int val);
> + int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
> + int (*reg_write)(void *context, unsigned int reg, unsigned int val);

I'd be inclined to just do this in the initial refectoring patches
rather than rerefactoring here.

> + if (!bus || !bus->fast_io) {
> mutex_init(&map->mutex);
> map->lock = regmap_lock_mutex;
> map->unlock = regmap_unlock_mutex;
> + } else {
> + spin_lock_init(&map->spinlock);
> + map->lock = regmap_lock_spinlock;
> + map->unlock = regmap_unlock_spinlock;

It's not immediately obvious to me that no-bus should be forced to use
mutexes - is there any great reason for tying the two together? I'd add
a flag to allow no-bus devices to choose, possibly as part of a separate
"bus" configuration thing that gets configured with a separate init
function.

> + if (!bus) {
> + map->cache_registers = true;
> + goto skip_format_initialization;
> + } else {
> + map->reg_read = _regmap_bus_read;
> + }

Not sure I understand cache_registers here. Why has this flag been
added?

> + * @reg_read: Optional callback that if filled will be used to perform
> + * all the reads from the registers.
> + * @reg_write: Optional callback that if filled will be used to perform
> + * all the writes to the registers.

I'd probably add some comment about not using this in conjunction with
SPI or I2C.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-12-27 20:01    [W:0.050 / U:3.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site