mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: andrey.smirnov@convergeddevices.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] Add "no-bus" option for regmap API
Date: Thu, 27 Dec 2012 18:24:02 +0000	[thread overview]
Message-ID: <20121227182401.GA6306@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1356083238-6932-4-git-send-email-andrew.smirnov@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1678 bytes --]

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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-12-27 18:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21  9:47 [PATCH 0/3] Add "no-bus" configuration " Andrey Smirnov
2012-12-21  9:47 ` [PATCH 1/3] Add provisions to have user-defined read operation Andrey Smirnov
2012-12-21  9:47 ` [PATCH 2/3] Add provisions to have user-defined write operation Andrey Smirnov
2012-12-21  9:47 ` [PATCH 3/3] Add "no-bus" option for regmap API Andrey Smirnov
2012-12-27 18:24   ` Mark Brown [this message]
2012-12-29 19:18     ` Andrey Smirnov
2012-12-27 17:41 ` [PATCH 0/3] Add "no-bus" configuration " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121227182401.GA6306@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=andrey.smirnov@convergeddevices.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome