lkml.org 
[lkml]   [2013]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regcache: Always make cache_present big enough for max_register
Date
There is no point in continually reallocating the cache_present bitmap
when we know how big it could possibly be.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/base/regmap/regcache.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 8a0ab5f..14c6eef 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -463,6 +463,9 @@ int regcache_set_reg_present(struct regmap *map, unsigned int reg)
int i;

nregs = reg + 1;
+ if (nregs < map->max_register + 1)
+ nregs = map->max_register + 1;
+
cache_present_size = BITS_TO_LONGS(nregs);
cache_present_size *= sizeof(long);

--
1.7.10.4


\
 
 \ /
  Last update: 2013-05-06 17:43    [W:0.026 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site