diff options
-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 a975a601f718..d0ce2fef43a3 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, | |||
1157 | /* If the caller supplied the value we can use it safely. */ | 1157 | /* If the caller supplied the value we can use it safely. */ |
1158 | memcpy(async->work_buf, map->work_buf, map->format.pad_bytes + | 1158 | memcpy(async->work_buf, map->work_buf, map->format.pad_bytes + |
1159 | map->format.reg_bytes + map->format.val_bytes); | 1159 | map->format.reg_bytes + map->format.val_bytes); |
1160 | if (val == work_val) | ||
1161 | val = async->work_buf + map->format.pad_bytes + | ||
1162 | map->format.reg_bytes; | ||
1163 | 1160 | ||
1164 | spin_lock_irqsave(&map->async_lock, flags); | 1161 | spin_lock_irqsave(&map->async_lock, flags); |
1165 | list_add_tail(&async->list, &map->async_list); | 1162 | list_add_tail(&async->list, &map->async_list); |
1166 | spin_unlock_irqrestore(&map->async_lock, flags); | 1163 | spin_unlock_irqrestore(&map->async_lock, flags); |
1167 | 1164 | ||
1168 | ret = map->bus->async_write(map->bus_context, async->work_buf, | 1165 | if (val != work_val) |
1169 | map->format.reg_bytes + | 1166 | ret = map->bus->async_write(map->bus_context, |
1170 | map->format.pad_bytes, | 1167 | async->work_buf, |
1171 | val, val_len, async); | 1168 | map->format.reg_bytes + |
1169 | map->format.pad_bytes, | ||
1170 | val, val_len, async); | ||
1171 | else | ||
1172 | ret = map->bus->async_write(map->bus_context, | ||
1173 | async->work_buf, | ||
1174 | map->format.reg_bytes + | ||
1175 | map->format.pad_bytes + | ||
1176 | val_len, NULL, 0, async); | ||
1172 | 1177 | ||
1173 | if (ret != 0) { | 1178 | if (ret != 0) { |
1174 | dev_err(map->dev, "Failed to schedule write: %d\n", | 1179 | dev_err(map->dev, "Failed to schedule write: %d\n", |