summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-10-10 16:06:32 -0400
committerMark Brown <broonie@linaro.org>2013-10-10 16:15:23 -0400
commitaffbe886e712437c25b575eac5fde5886bb42aec (patch)
tree093be88c70e2111328ba45fe580fc558374ea1a6 /drivers/base
parent1a25f26138cde2b83fd74ead6da0bbd4b6c42b60 (diff)
regmap: Use async I/O during cache sync
Try to speed up I/O a little by not synchronising until we are finished scheduling writes. A brief survey of existing users suggests we have none that would currently benefit from an async cache sync. Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index a36112af494c..d4dd77134814 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -307,6 +307,8 @@ int regcache_sync(struct regmap *map)
307 if (!map->cache_dirty) 307 if (!map->cache_dirty)
308 goto out; 308 goto out;
309 309
310 map->async = true;
311
310 /* Apply any patch first */ 312 /* Apply any patch first */
311 map->cache_bypass = 1; 313 map->cache_bypass = 1;
312 for (i = 0; i < map->patch_regs; i++) { 314 for (i = 0; i < map->patch_regs; i++) {
@@ -332,11 +334,15 @@ int regcache_sync(struct regmap *map)
332 map->cache_dirty = false; 334 map->cache_dirty = false;
333 335
334out: 336out:
335 trace_regcache_sync(map->dev, name, "stop");
336 /* Restore the bypass state */ 337 /* Restore the bypass state */
338 map->async = false;
337 map->cache_bypass = bypass; 339 map->cache_bypass = bypass;
338 map->unlock(map->lock_arg); 340 map->unlock(map->lock_arg);
339 341
342 regmap_async_complete(map);
343
344 trace_regcache_sync(map->dev, name, "stop");
345
340 return ret; 346 return ret;
341} 347}
342EXPORT_SYMBOL_GPL(regcache_sync); 348EXPORT_SYMBOL_GPL(regcache_sync);
@@ -375,17 +381,23 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
375 if (!map->cache_dirty) 381 if (!map->cache_dirty)
376 goto out; 382 goto out;
377 383
384 map->async = true;
385
378 if (map->cache_ops->sync) 386 if (map->cache_ops->sync)
379 ret = map->cache_ops->sync(map, min, max); 387 ret = map->cache_ops->sync(map, min, max);
380 else 388 else
381 ret = regcache_default_sync(map, min, max); 389 ret = regcache_default_sync(map, min, max);
382 390
383out: 391out:
384 trace_regcache_sync(map->dev, name, "stop region");
385 /* Restore the bypass state */ 392 /* Restore the bypass state */
386 map->cache_bypass = bypass; 393 map->cache_bypass = bypass;
394 map->async = false;
387 map->unlock(map->lock_arg); 395 map->unlock(map->lock_arg);
388 396
397 regmap_async_complete(map);
398
399 trace_regcache_sync(map->dev, name, "stop region");
400
389 return ret; 401 return ret;
390} 402}
391EXPORT_SYMBOL_GPL(regcache_sync_region); 403EXPORT_SYMBOL_GPL(regcache_sync_region);