Skip to content

Commit d32758a

Browse files
committed
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>
1 parent bfa0b38 commit d32758a

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

drivers/base/regmap/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static inline const void *regcache_get_val_addr(struct regmap *map,
269269

270270
unsigned int regcache_get_val(struct regmap *map, const void *base,
271271
unsigned int idx);
272-
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
272+
void regcache_set_val(struct regmap *map, void *base, unsigned int idx,
273273
unsigned int val);
274274
int regcache_lookup_reg(struct regmap *map, unsigned int reg);
275275
int regcache_sync_val(struct regmap *map, unsigned int reg, unsigned int val);

drivers/base/regmap/regcache.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -558,17 +558,14 @@ void regcache_cache_bypass(struct regmap *map, bool enable)
558558
}
559559
EXPORT_SYMBOL_GPL(regcache_cache_bypass);
560560

561-
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
561+
void regcache_set_val(struct regmap *map, void *base, unsigned int idx,
562562
unsigned int val)
563563
{
564-
if (regcache_get_val(map, base, idx) == val)
565-
return true;
566-
567564
/* Use device native format if possible */
568565
if (map->format.format_val) {
569566
map->format.format_val(base + (map->cache_word_size * idx),
570567
val, 0);
571-
return false;
568+
return;
572569
}
573570

574571
switch (map->cache_word_size) {
@@ -601,7 +598,6 @@ bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
601598
default:
602599
BUG();
603600
}
604-
return false;
605601
}
606602

607603
unsigned int regcache_get_val(struct regmap *map, const void *base,

0 commit comments

Comments
 (0)