diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-07 12:56:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-07 12:56:00 -0400 |
commit | f4e52e7ffdea791c89494752b175b991090f0920 (patch) | |
tree | 5ba632b8127ebc1a71f52102ef59d44c41eeb67b /drivers/base | |
parent | a3fac08085136fb8b56bbd290500ed03c94ee5d1 (diff) | |
parent | c04c1b9ee8f30c7a3a25e20e406247003f634ebe (diff) |
Merge tag 'regmap-3.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull two more small regmap fixes from Mark Brown:
- Now we have users for it that aren't running Android it turns out
that regcache_sync_region() is much more useful to drivers if it's
exported for use by modules. Who knew?
- Make sure we don't divide by zero when doing debugfs dumps of
rbtrees, not visible up until now because everything was providing at
least some cache on startup.
* tag 'regmap-3.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
regmap: prevent division by zero in rbtree_show
regmap: Export regcache_sync_region()
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regcache-rbtree.c | 8 | ||||
-rw-r--r-- | drivers/base/regmap/regcache.c | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index fb14a6343d4f..92b779ee002b 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -138,6 +138,7 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
138 | unsigned int base, top; | 138 | unsigned int base, top; |
139 | int nodes = 0; | 139 | int nodes = 0; |
140 | int registers = 0; | 140 | int registers = 0; |
141 | int average; | ||
141 | 142 | ||
142 | mutex_lock(&map->lock); | 143 | mutex_lock(&map->lock); |
143 | 144 | ||
@@ -152,8 +153,13 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
152 | registers += top - base + 1; | 153 | registers += top - base + 1; |
153 | } | 154 | } |
154 | 155 | ||
156 | if (nodes) | ||
157 | average = registers / nodes; | ||
158 | else | ||
159 | average = 0; | ||
160 | |||
155 | seq_printf(s, "%d nodes, %d registers, average %d registers\n", | 161 | seq_printf(s, "%d nodes, %d registers, average %d registers\n", |
156 | nodes, registers, registers / nodes); | 162 | nodes, registers, average); |
157 | 163 | ||
158 | mutex_unlock(&map->lock); | 164 | mutex_unlock(&map->lock); |
159 | 165 | ||
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 87f54dbf601b..74b69095def6 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -346,6 +346,7 @@ out: | |||
346 | 346 | ||
347 | return ret; | 347 | return ret; |
348 | } | 348 | } |
349 | EXPORT_SYMBOL_GPL(regcache_sync_region); | ||
349 | 350 | ||
350 | /** | 351 | /** |
351 | * regcache_cache_only: Put a register map into cache only mode | 352 | * regcache_cache_only: Put a register map into cache only mode |