regmap: Don't check for changes in regcache_set_val()

The only user of regcache_set_val() ignores the return value so we may as
well not bother checking if the value we are trying to set is the same as
the value already stored.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230609-regcache-set-val-no-ret-v1-1-9a6932760cf8@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Mark Brown 2023-06-10 15:05:54 +01:00
parent bfa0b38c14
commit d32758acbd
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 3 additions and 7 deletions

View File

@ -269,7 +269,7 @@ static inline const void *regcache_get_val_addr(struct regmap *map,
unsigned int regcache_get_val(struct regmap *map, const void *base, unsigned int regcache_get_val(struct regmap *map, const void *base,
unsigned int idx); unsigned int idx);
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx, void regcache_set_val(struct regmap *map, void *base, unsigned int idx,
unsigned int val); unsigned int val);
int regcache_lookup_reg(struct regmap *map, unsigned int reg); int regcache_lookup_reg(struct regmap *map, unsigned int reg);
int regcache_sync_val(struct regmap *map, unsigned int reg, unsigned int val); int regcache_sync_val(struct regmap *map, unsigned int reg, unsigned int val);

View File

@ -558,17 +558,14 @@ void regcache_cache_bypass(struct regmap *map, bool enable)
} }
EXPORT_SYMBOL_GPL(regcache_cache_bypass); EXPORT_SYMBOL_GPL(regcache_cache_bypass);
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx, void regcache_set_val(struct regmap *map, void *base, unsigned int idx,
unsigned int val) unsigned int val)
{ {
if (regcache_get_val(map, base, idx) == val)
return true;
/* Use device native format if possible */ /* Use device native format if possible */
if (map->format.format_val) { if (map->format.format_val) {
map->format.format_val(base + (map->cache_word_size * idx), map->format.format_val(base + (map->cache_word_size * idx),
val, 0); val, 0);
return false; return;
} }
switch (map->cache_word_size) { switch (map->cache_word_size) {
@ -601,7 +598,6 @@ bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
default: default:
BUG(); BUG();
} }
return false;
} }
unsigned int regcache_get_val(struct regmap *map, const void *base, unsigned int regcache_get_val(struct regmap *map, const void *base,