[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190813212251.12316-1-ben.whitten@gmail.com>
Date: Tue, 13 Aug 2019 22:22:51 +0100
From: Ben Whitten <ben.whitten@...il.com>
To: linux-kernel@...r.kernel.org
Cc: afaerber@...e.de, Ben Whitten <ben.whitten@...il.com>,
Mark Brown <broonie@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Subject: [PATCH] regmap: fix writes to non incrementing registers
When checking if a register is writable we must first check if the
register is a non incrementing writable register.
Non incrementing register are deep and do not move to the next
register when writing, for example a FIFO.
Signed-off-by: Ben Whitten <ben.whitten@...il.com>
---
drivers/base/regmap/regmap.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index f1025452bb39..70645a28897c 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1489,10 +1489,11 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
WARN_ON(!map->bus);
/* Check for unwritable registers before we start */
- for (i = 0; i < val_len / map->format.val_bytes; i++)
- if (!regmap_writeable(map,
- reg + regmap_get_offset(map, i)))
- return -EINVAL;
+ if (!regmap_writeable_noinc(map, reg))
+ for (i = 0; i < val_len / map->format.val_bytes; i++)
+ if (!regmap_writeable(map,
+ reg + regmap_get_offset(map, i)))
+ return -EINVAL;
if (!map->cache_bypass && map->format.parse_val) {
unsigned int ival;
--
2.17.1
Powered by blists - more mailing lists