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-prev] [day] [month] [year] [list]
Date:	Mon, 19 Sep 2011 19:03:44 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>
Cc:	linux-kernel@...r.kernel.org, Lars-Peter Clausen <lars@...afoo.de>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: [PATCH 5/5] regmap: Fix hookup of regcache into regmap

- Only suppress physical writes if we're in cache only mode
- Use the cache for all reads, not just internal ones
- Return -EBUSY if we're in cache only mode.

Signed-off-by: Mark Brown <broonie@...nsource.wolfsonmicro.com>
---
 drivers/base/regmap/regmap.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 602083f..3596465 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -304,7 +304,9 @@ static int _regmap_write(struct regmap *map, unsigned int reg,
 
 	if (!map->cache_bypass) {
 		ret = regcache_write(map, reg, val);
-		if (!ret || map->cache_only)
+		if (ret != 0)
+			return ret;
+		if (map->cache_only)
 			return 0;
 	}
 
@@ -421,6 +423,15 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
 	if (!map->format.parse_val)
 		return -EINVAL;
 
+	if (!map->cache_bypass) {
+		ret = regcache_read(map, reg, val);
+		if (ret == 0)
+			return 0;
+	}
+
+	if (map->cache_only)
+		return -EBUSY;
+
 	ret = _regmap_raw_read(map, reg, map->work_buf, map->format.val_bytes);
 	if (ret == 0) {
 		*val = map->format.parse_val(map->work_buf);
@@ -446,14 +457,6 @@ int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val)
 
 	mutex_lock(&map->lock);
 
-	if (!map->cache_bypass) {
-		ret = regcache_read(map, reg, val);
-		if (!ret) {
-			mutex_unlock(&map->lock);
-			return 0;
-		}
-	}
-
 	ret = _regmap_read(map, reg, val);
 
 	mutex_unlock(&map->lock);
-- 
1.7.6.3

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