Re: [PATCH 1/3] mfd: arizona: Add support for CS47L24

From: Mark Brown
Date: Tue Nov 18 2014 - 10:01:17 EST


On Mon, Nov 17, 2014 at 03:13:18PM +0000, Charles Keepax wrote:

> 1) We could add #defines for various IP blocks and the readable
> callback could include these defines for various blocks. Which
> would reduce the duplication between chips. Although a lot of the
> blocks have small differences between chips which might hurt some
> of the benefits and this does also have some negative affects on the
> greppability of it all. This could also be done as functions then
> some of the differences could be taken into account locally for
> each block but that hurts the performance and probably
> readability.

I don't follow this suggestion, sorry.

> 2) We could add a function to the regmap core that makes any
> register with a default or marked as volatile readable. That
> would remove the readable callback completely and not really hurt
> greppability (assuming we could change the default array to use
> the #defines for the register) but at fairly large runtime cost.
> We would have to search the default array everytime we wanted to
> check if a register is readable.

This sounds far too expensive at runtime, especially for large register
sets. You can do tables of ranges but that's much more efficient since
the expecation is that if you're using that there's an order of
magnitude size difference.

Honestly I'm not sure I see a big problem with the large tables; they're
large but not hard to think about, from my point of view large blocks of
code are scary but large blocks of data, meh.

Attachment: signature.asc
Description: Digital signature