From: Ben Whitten <ben.whitten@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: afaerber@suse.de, Ben Whitten <ben.whitten@gmail.com>,
Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: [PATCH] regmap: fix writes to non incrementing registers
Date: Tue, 13 Aug 2019 22:22:51 +0100 [thread overview]
Message-ID: <20190813212251.12316-1-ben.whitten@gmail.com> (raw)
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
next reply other threads:[~2019-08-13 21:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-13 21:22 Ben Whitten [this message]
2019-08-14 10:01 ` Mark Brown
2019-08-14 13:09 ` Ben Whitten
2019-08-14 13:32 ` Andreas Färber
2019-08-14 16:05 ` Mark Brown
2019-08-14 16:44 ` Andreas Färber
2019-08-14 16:19 ` Mark Brown
2019-09-03 9:42 ` Ben Whitten
2019-09-03 12:12 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190813212251.12316-1-ben.whitten@gmail.com \
--to=ben.whitten@gmail.com \
--cc=afaerber@suse.de \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®