Re: [PATCH 6/6 v3] regmap: Incorporate the regcache core into regmap

From: Lars-Peter Clausen
Date: Thu Sep 15 2011 - 19:21:09 EST


On 09/16/2011 12:57 AM, Mark Brown wrote:
> On Thu, Sep 15, 2011 at 05:19:32PM +0200, Lars-Peter Clausen wrote:
>
>>> + if (!map->cache_bypass) {
>>> + ret = regcache_read(map, reg, val);
>>> + if (!ret) {
>>> + mutex_unlock(&map->lock);
>>> + return 0;
>>> + }
>
>> So in case regmap_readable is not true for this register regcache_read will
>> return -EIO and we'll fallback to an uncached read. This doesn't make sense in
>> my opinion. Or what are the except semantics regmap_readable supposed to be?
>
> It's a bit interesting but falling back to asking the hardware is
> probably the right thing to do for cases where you're doing things like
> using unspecified registers to activate undocumented features - the
> register isn't really documented as being there and may do odd things
> but if the device manufacturer gives you an approved sequence then you
> can probably use it safely.

But for writes the error is propagated to the caller, instead of falling back
to a hw write. There should be at least consistency between the two.

And I think we should document that regmap_readable and regmap_writeable don't
prevent actuall hw access, but are merely meant as hints for stuff like caching.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/