From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-kernel@vger.kernel.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>, Graeme Gregory <gg@slimlogic.co.uk>,
Samuel Oritz <sameo@linux.intel.com>
Subject: Re: [PATCH 1/6 v3] regmap: Introduce caching support
Date: Thu, 15 Sep 2011 16:32:27 +0100 [thread overview]
Message-ID: <20110915153227.GA7022@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <4E721595.9040108@metafoo.de>
On Thu, Sep 15, 2011 at 05:11:17PM +0200, Lars-Peter Clausen wrote:
> Tested-by: Lars-Peter Clausen <lars@metafoo.de> (for REGCACHE_NONE and
> REGCACHE_RBTREE)
>
> Some minor comments though:
>
> > -
> > +/**
> > + * regcache_read: Fetch the value of a given register from the cache.
> > + *
> > + * @map: map to configure.
> > + * @reg: The register index.
> > + * @value: The value to be returned.
> > + *
> > + * Return a negative value on failure, 0 on success.
> > + */
> > +int regcache_read(struct regmap *map,
> > + unsigned int reg, unsigned int *value)
> > +{
> > + unsigned int max_reg;
> > +
> > + if (map->cache_type == REGCACHE_NONE)
> > + return -ENOSYS;
> > +
> > + BUG_ON(!map->cache_ops);
> > +
> > + if (!regmap_readable(map, reg))
> > + return -EIO;
> > +
> > + if (map->max_register)
> > + max_reg = map->max_register;
> > + else
> > + max_reg = map->num_cache_defaults_raw;
>
> In my opinion we should initialize max_register to num_cache_defaults_raw if it
> is not set during initialization instead of doing this check each time. Also
> regmap_readable already checks whether the register is in the register range,
> so there is no need to repeat the check here.
Yes, that makes sense.
> > +
> > +
> > + if (reg < max_reg && !regmap_volatile(map, reg))
> > + return map->cache_ops->read(map, reg, value);
> > + return -EINVAL;
> > +}
> > +EXPORT_SYMBOL_GPL(regcache_read);
> > +
next prev parent reply other threads:[~2011-09-15 15:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-15 10:34 [PATCH 0/6 v3] Introduce caching support for regmap Dimitris Papastamos
2011-09-15 10:34 ` [PATCH 1/6 v3] regmap: Introduce caching support Dimitris Papastamos
2011-09-15 15:11 ` Lars-Peter Clausen
2011-09-15 15:32 ` Dimitris Papastamos [this message]
2011-09-15 10:34 ` [PATCH 2/6 v3] regmap: Add the indexed cache support Dimitris Papastamos
2011-09-15 10:34 ` [PATCH 3/6 v3] regmap: Add the rbtree " Dimitris Papastamos
2011-09-15 10:34 ` [PATCH 4/6 v3] regmap: Add the LZO " Dimitris Papastamos
2011-09-15 10:34 ` [PATCH 5/6 v3] regmap: Add the regcache_sync trace event Dimitris Papastamos
2011-09-15 10:34 ` [PATCH 6/6 v3] regmap: Incorporate the regcache core into regmap Dimitris Papastamos
2011-09-15 15:19 ` Lars-Peter Clausen
2011-09-15 15:37 ` Dimitris Papastamos
2011-09-15 22:57 ` Mark Brown
2011-09-15 23:20 ` Lars-Peter Clausen
2011-09-15 23:53 ` 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=20110915153227.GA7022@opensource.wolfsonmicro.com \
--to=dp@opensource.wolfsonmicro.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gg@slimlogic.co.uk \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=sameo@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.