lkml.org 
[lkml]   [2019]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regmap: fix writes to non incrementing registers
Date
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@gmail.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
\
 
 \ /
  Last update: 2019-08-13 23:25    [W:0.058 / U:6.392 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site