OSDN Git Service

regmap: debugfs: Cache offsets of valid regions for dump
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 10 Dec 2012 16:24:29 +0000 (01:24 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 10 Dec 2012 16:29:47 +0000 (01:29 +0900)
commit5166b7c006eeb4f6becc0822974d8da259484ba1
treeb28c4098a5b75a34efd8262efcc99fdf8d586365
parentafab2f7b21b042bcbffb1e82f78243382a122d70
regmap: debugfs: Cache offsets of valid regions for dump

Avoid doing a linear scan of the entire register map for each read() of
the debugfs register dump by recording the offsets where valid registers
exist when we first read the registers file. This assumes the set of
valid registers never changes, if this is not the case invalidation of
the cache will be required.

This could be further improved for large blocks of contiguous registers
by calculating the register we will read from within the block - currently
we do a linear scan of the block. An rbtree may also be worthwhile.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/internal.h
drivers/base/regmap/regmap-debugfs.c