mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 10:33:27 +00:00
regmap: Suppress noop writes in regmap_update_bits()
If the new register value is identical to the original one then suppress the write to the hardware in regmap_update_bits(), saving some I/O cost. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
4c69166458
commit
d91e8db2c3
1 changed files with 5 additions and 4 deletions
|
@ -583,18 +583,19 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
|
|||
unsigned int mask, unsigned int val)
|
||||
{
|
||||
int ret;
|
||||
unsigned int tmp;
|
||||
unsigned int tmp, orig;
|
||||
|
||||
mutex_lock(&map->lock);
|
||||
|
||||
ret = _regmap_read(map, reg, &tmp);
|
||||
ret = _regmap_read(map, reg, &orig);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
|
||||
tmp &= ~mask;
|
||||
tmp = orig & ~mask;
|
||||
tmp |= val & mask;
|
||||
|
||||
ret = _regmap_write(map, reg, tmp);
|
||||
if (tmp != orig)
|
||||
ret = _regmap_write(map, reg, tmp);
|
||||
|
||||
out:
|
||||
mutex_unlock(&map->lock);
|
||||
|
|
Loading…
Reference in a new issue