mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: linux-kernel@vger.kernel.org
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 2/2] regmap: cache: Use raw I/O to sync rbtrees if we can
Date: Wed, 27 Mar 2013 13:06:18 +0000	[thread overview]
Message-ID: <1364389578-8714-2-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1364389578-8714-1-git-send-email-broonie@opensource.wolfsonmicro.com>

This will bring no meaningful benefit by itself, it is done as a separate
commit to aid bisection if there are problems with the following commits
adding support for coalescing adjacent writes.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/base/regmap/regcache-rbtree.c |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 792a760..382a6de 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -55,6 +55,12 @@ static unsigned int regcache_rbtree_get_register(struct regmap *map,
 	return regcache_get_val(map, rbnode->block, idx);
 }
 
+static const void *regcache_rbtree_get_reg_addr(struct regmap *map,
+	struct regcache_rbtree_node *rbnode, unsigned int idx)
+{
+	return regcache_get_val_addr(map, rbnode->block, idx);
+}
+
 static void regcache_rbtree_set_register(struct regmap *map,
 					 struct regcache_rbtree_node *rbnode,
 					 unsigned int idx, unsigned int val)
@@ -442,6 +448,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
 	struct regcache_rbtree_node *rbnode;
 	unsigned int regtmp;
 	unsigned int val;
+	const void *addr;
 	int ret;
 	int i, base, end;
 
@@ -480,7 +487,17 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
 				continue;
 
 			map->cache_bypass = 1;
-			ret = _regmap_write(map, regtmp, val);
+
+			if (regmap_can_raw_write(map)) {
+				addr = regcache_rbtree_get_reg_addr(map,
+								    rbnode, i);
+				ret = _regmap_raw_write(map, regtmp, addr,
+							map->format.val_bytes,
+							false);
+			} else {
+				ret = _regmap_write(map, regtmp, val);
+			}
+
 			map->cache_bypass = 0;
 			if (ret)
 				return ret;
-- 
1.7.10.4


      reply	other threads:[~2013-03-27 13:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27 13:06 [PATCH 1/2] regmap: core: Provide regmap_can_raw_write() operation Mark Brown
2013-03-27 13:06 ` Mark Brown [this message]

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=1364389578-8714-2-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.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®