Skip to content

Commit

Permalink
regmap: Add trace event for successful cache reads
Browse files Browse the repository at this point in the history
Currently we only trace physical reads, there's no instrumentation if
the read is satisfied from cache.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Nov 30, 2011
1 parent 018690d commit bc7ee55
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/base/regmap/regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,21 @@ void regcache_exit(struct regmap *map)
int regcache_read(struct regmap *map,
unsigned int reg, unsigned int *value)
{
int ret;

if (map->cache_type == REGCACHE_NONE)
return -ENOSYS;

BUG_ON(!map->cache_ops);

if (!regmap_volatile(map, reg))
return map->cache_ops->read(map, reg, value);
if (!regmap_volatile(map, reg)) {
ret = map->cache_ops->read(map, reg, value);

if (ret == 0)
trace_regmap_reg_read_cache(map->dev, reg, *value);

return ret;
}

return -EINVAL;
}
Expand Down
9 changes: 9 additions & 0 deletions include/trace/events/regmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ DEFINE_EVENT(regmap_reg, regmap_reg_read,

);

DEFINE_EVENT(regmap_reg, regmap_reg_read_cache,

TP_PROTO(struct device *dev, unsigned int reg,
unsigned int val),

TP_ARGS(dev, reg, val)

);

DECLARE_EVENT_CLASS(regmap_block,

TP_PROTO(struct device *dev, unsigned int reg, int count),
Expand Down

0 comments on commit bc7ee55

Please sign in to comment.