All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] regmap: Minor optimisation for _regmap_raw_write().
@ 2012-05-31 15:11 Krystian Garbaciak
  2012-05-31 16:44 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Krystian Garbaciak @ 2012-05-31 15:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-kernel, Anthony Olech

Just to make things simplier inside the function.

Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
---
 drivers/base/regmap/regmap.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c32d1a6..7581ad9 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -612,17 +612,18 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
 {
 	int i;
 	int ret;
+	unsigned int val_num = val_len / map->format.val_bytes;
 
 	/* Check for unwritable registers before we start */
 	if (map->writeable_reg)
-		for (i = 0; i < val_len / map->format.val_bytes; i++)
+		for (i = 0; i < val_num; i++)
 			if (!map->writeable_reg(map->dev, reg + i))
 				return -EINVAL;
 
 	if (!map->cache_bypass && map->format.parse_val) {
 		unsigned int ival;
 		int val_bytes = map->format.val_bytes;
-		for (i = 0; i < val_len / map->format.val_bytes; i++) {
+		for (i = 0; i < val_num; i++) {
 			memcpy(map->work_buf, val + (i * val_bytes), val_bytes);
 			ival = map->format.parse_val(map->work_buf);
 			ret = regcache_write(map, reg + i, ival);
@@ -639,8 +640,8 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
 		}
 	}
 
-	return _regmap_range_access(_regmap_bus_write, map, reg, (void *)val,
-				    val_len / map->format.val_bytes);
+	return _regmap_range_access(_regmap_bus_write,
+				    map, reg, (void *)val, val_num);
 }
 
 int _regmap_write(struct regmap *map, unsigned int reg,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-31 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-31 15:11 [PATCH 4/4] regmap: Minor optimisation for _regmap_raw_write() Krystian Garbaciak
2012-05-31 16:44 ` Mark Brown
2012-05-31 17:57   ` Krystian Garbaciak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.