[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1367852768-31389-1-git-send-email-broonie@opensource.wolfsonmicro.com>
Date: Mon, 6 May 2013 16:06:08 +0100
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: Mark Brown <broonie@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: [PATCH] regcache: Always make cache_present big enough for max_register
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@...nsource.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists