lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <201205311622.q4VGMHGe015484@sw-eng-lt-dc-vm2>
Date:	Thu, 31 May 2012 17:11:38 +0200
From:	Krystian Garbaciak <krystian.garbaciak@...semi.com>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org,
	Anthony Olech <Anthony.Olech@...semi.com>
Subject: [PATCH 4/4] regmap: Minor optimisation for _regmap_raw_write().

Just to make things simplier inside the function.

Signed-off-by: Krystian Garbaciak <krystian.garbaciak@...semi.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

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ