[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121227182401.GA6306@opensource.wolfsonmicro.com>
Date: Thu, 27 Dec 2012 18:24:02 +0000
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: Andrey Smirnov <andrew.smirnov@...il.com>
Cc: andrey.smirnov@...vergeddevices.net, linux-kernel@...r.kernel.org
Subject: Re: [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.
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists