diff options
author | Mark Brown <broonie@linaro.org> | 2013-10-10 21:38:29 (GMT) |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-14 21:09:26 (GMT) |
commit | 04c50ccf0dab02923ef888a4839bfbd00de03181 (patch) | |
tree | d9e0981c77d0436410b20f518eaa0afd8bee8472 /drivers/base/regmap | |
parent | cd1b9dd0220d3c126b3b61c1f96f0832fc21fc61 (diff) | |
download | linux-04c50ccf0dab02923ef888a4839bfbd00de03181.tar.xz |
regmap: Only send a single buffer for async I/O if writing one register
Extend the interface for async I/O by allowing the value buffer to be
omitted and sending the value as part of the register buffer, minimising
the number of separate hardware operations required.
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r-- | drivers/base/regmap/regmap.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index a975a60..d0ce2fef 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1157,18 +1157,23 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, /* If the caller supplied the value we can use it safely. */ memcpy(async->work_buf, map->work_buf, map->format.pad_bytes + map->format.reg_bytes + map->format.val_bytes); - if (val == work_val) - val = async->work_buf + map->format.pad_bytes + - map->format.reg_bytes; spin_lock_irqsave(&map->async_lock, flags); list_add_tail(&async->list, &map->async_list); spin_unlock_irqrestore(&map->async_lock, flags); - ret = map->bus->async_write(map->bus_context, async->work_buf, - map->format.reg_bytes + - map->format.pad_bytes, - val, val_len, async); + if (val != work_val) + ret = map->bus->async_write(map->bus_context, + async->work_buf, + map->format.reg_bytes + + map->format.pad_bytes, + val, val_len, async); + else + ret = map->bus->async_write(map->bus_context, + async->work_buf, + map->format.reg_bytes + + map->format.pad_bytes + + val_len, NULL, 0, async); if (ret != 0) { dev_err(map->dev, "Failed to schedule write: %d\n", |