Linux driver-core infrastructure
 help / color / mirror / Atom feed
From: phucduc.bui@gmail.com
To: Mark Brown <broonie@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	rafael@kernel.org
Cc: Danilo Krummrich <dakr@kernel.org>,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH] regcache: disable cache_only before rewriting paging registers
Date: Mon, 13 Jul 2026 14:30:58 +0700	[thread overview]
Message-ID: <20260713073059.47914-1-phucduc.bui@gmail.com> (raw)

From: bui duc phuc <phucduc.bui@gmail.com>

cache_only must be disabled before re-writing the paging selector
registers. Otherwise, _regmap_write() would update only the cache
and return without calling map->reg_write(), leaving the selector
register on the hardware unwritten and out of sync with the cache.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

Note: This patch was created while working on the following patch series:
https://lore.kernel.org/all/20260713050312.38729-1-phucduc.bui@gmail.com/

 drivers/base/regmap/regcache.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 96cdae25b9c4..43ee7c6c32d8 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -406,6 +406,7 @@ int regcache_sync(struct regmap *map)
 	unsigned int i;
 	const char *name;
 	bool bypass;
+	bool cache_only;
 	struct rb_node *node;
 
 	if (WARN_ON(map->cache_type == REGCACHE_NONE))
@@ -455,6 +456,9 @@ int regcache_sync(struct regmap *map)
 	 * have gone out of sync, force writes of all the paging
 	 * registers.
 	 */
+	cache_only = map->cache_only;
+	map->cache_only = false;
+
 	rb_for_each(node, NULL, &map->range_tree, rbtree_all) {
 		struct regmap_range_node *this =
 			rb_entry(node, struct regmap_range_node, node);
@@ -472,6 +476,8 @@ int regcache_sync(struct regmap *map)
 		}
 	}
 
+	map->cache_only = cache_only;
+
 	map->unlock(map->lock_arg);
 
 	regmap_async_complete(map);
-- 
2.43.0


             reply	other threads:[~2026-07-13  7:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  7:30 phucduc.bui [this message]
2026-07-13 11:58 ` [PATCH] regcache: disable cache_only before rewriting paging registers Mark Brown
2026-07-13 13:07   ` Bui Duc Phuc
2026-07-13 13:43     ` Mark Brown
2026-07-13 14:59       ` Bui Duc Phuc
2026-07-13 15:06         ` Mark Brown
2026-07-13 21:58           ` Bui Duc Phuc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260713073059.47914-1-phucduc.bui@gmail.com \
    --to=phucduc.bui@gmail.com \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox