From 7bbbfb8c5dd2d54ca644447b0799e081cc862556 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 1 Dec 2023 15:22:43 +0000 Subject: [PATCH] Revert "regmap: Ensure range selector registers are updated after cache sync" This reverts commit 117ccba0288b2cfce4645575053e5daeb619b938. The reverted commit breaks at least some I2C-based soundcards, and possibly much more. Thanks for pointing the finger, HiassofT. See: https://github.com/raspberrypi/linux/issues/5763 Signed-off-by: Phil Elwell --- drivers/base/regmap/regcache.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index d525f998306649..7d3e47436056e5 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -334,11 +334,6 @@ static int regcache_default_sync(struct regmap *map, unsigned int min, return 0; } -static int rbtree_all(const void *key, const struct rb_node *node) -{ - return 0; -} - /** * regcache_sync - Sync the register cache with the hardware. * @@ -356,7 +351,6 @@ int regcache_sync(struct regmap *map) unsigned int i; const char *name; bool bypass; - struct rb_node *node; if (WARN_ON(map->cache_type == REGCACHE_NONE)) return -EINVAL; @@ -398,30 +392,6 @@ int regcache_sync(struct regmap *map) /* Restore the bypass state */ map->cache_bypass = bypass; map->no_sync_defaults = false; - - /* - * If we did any paging with cache bypassed and a cached - * paging register then the register and cache state might - * have gone out of sync, force writes of all the paging - * registers. - */ - rb_for_each(node, 0, &map->range_tree, rbtree_all) { - struct regmap_range_node *this = - rb_entry(node, struct regmap_range_node, node); - - /* If there's nothing in the cache there's nothing to sync */ - ret = regcache_read(map, this->selector_reg, &i); - if (ret != 0) - continue; - - ret = _regmap_write(map, this->selector_reg, i); - if (ret != 0) { - dev_err(map->dev, "Failed to write %x = %x: %d\n", - this->selector_reg, i, ret); - break; - } - } - map->unlock(map->lock_arg); regmap_async_complete(map);