[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1381253880-27853-1-git-send-email-broonie@kernel.org>
Date: Tue, 8 Oct 2013 18:38:00 +0100
From: Mark Brown <broonie@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: linaro-kernel@...ts.linaro.org, Mark Brown <broonie@...aro.org>
Subject: [PATCH] regmap: Don't generate gather writes for single register raw writes
From: Mark Brown <broonie@...aro.org>
Since it is quite common for single register raw or async writes to be
generated by rbtree cache syncs or firmware downloads and essentially all
hardware will be faster with only a single transfer optimise this case by
copying single values into the internal scratch buffer before sending.
Signed-off-by: Mark Brown <broonie@...aro.org>
---
drivers/base/regmap/regmap.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 5754513..4866ae5 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1118,6 +1118,16 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
u8[0] |= map->write_flag_mask;
+ /*
+ * Essentially all I/O mechanisms will be faster with a single
+ * buffer to write. Since register syncs often generate raw
+ * writes of single registers optimise that case.
+ */
+ if (val != work_val && val_len == map->format.val_bytes) {
+ memcpy(work_val, val, map->format.val_bytes);
+ val = work_val;
+ }
+
if (async && map->bus->async_write) {
struct regmap_async *async;
--
1.8.4.rc3
--
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