From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B444738E133 for ; Mon, 13 Jul 2026 07:31:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783927876; cv=none; b=INfFO8wQ3bFYVuvFHrPio1CCJwPuAdFDjvrLvhQiy1lHm7Kb+xgrxfTR6a06e5Bad0pQ9+pysTml1gE36XDJiva5PCBgF0xZSpK9dFCxgyKP12nnKKi33t7MW5+L7sybkToJg7we2WBpk76rPiKxGOcMAw6OGf2JrSB0K0zpnxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783927876; c=relaxed/simple; bh=nE94jIpzbTpP6e3RBc5xMQLNFbMWa6pESy1FsxCN9Zc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bpmXsw+pJ5Kbm6lbyLs4EWG7TLPRO5uXaiMyKyJvfTKTzP9J3c2D2s5ztF5u+JU59t2n/9NCuyfhEsjV52fDsBsATaEKhpOULPA8zMDSgx12f+8Gdidg+iQTBcS8nGF8T25crToEQRhkKLIuDsEiuMQngKb4VxgI4a3LnfUHS/A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dvHHeR9P; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dvHHeR9P" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2ce7d2adef4so37424205ad.3 for ; Mon, 13 Jul 2026 00:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783927874; x=1784532674; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=eeHOpcp3LVDBa1WcVuoFtpJpeqLR6lLlad78twh11no=; b=dvHHeR9P/7edvZiVKRYehGuuyDnkj0lDThj2bmL1+8RroKXtw106OWH+eT0vyzD4tM Abjtu6DEugJNBS3jp45auSvclVT7AiUEAOGpjKq54BGAek0Q+AD8I710mI4ADJlynMC+ nHRx7smUYXLljA9Kjw2pisNo10JL6/sVmM/kUG4UQkQM2Lo0CN5/aR9uPertN89uCPU5 GF5l9mOp/DoEQ94h65HPTAwPoQtid3I81nt/zkKUvTooc/jZHgfXh0c0qhwzndWkLZZY FOpRBSNfE6WgbDXul4+/rblgFQRqyzRqf4CZrePxH8Yd5dr8C43TZNY9ePACJ4WkNdfT QYVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783927874; x=1784532674; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=eeHOpcp3LVDBa1WcVuoFtpJpeqLR6lLlad78twh11no=; b=Q6tT/PZdWn6hL80IinF4dpny73Tr12wZjDZ1NZiZGJNbtWVUaaQE8YtqvAgoEpewCd eH9/rNAHU2WLxmuGXqkfMK23VIURt9zwpggDtmcsoKtwAaqvlVmOs2g0L4CAPhf306h1 VB/S3j08Ye9ofANjNthQl44MGzX2Aq2TIntqzEYlOzV6lXWOJOYv8eUhqFsDYd701nWq 8U7NpNcjgwmUe7aZ9C0JSNmxEWHgruMvtqee3sQ7atkRJkgeLHKpLoEAE06nL43NsVK/ lyoRHaljRovSQ/FH9pU+hhUS9D6FC6Yxfi90ID9neU7TPg0HYC/MbNEbt4AhheJdT3OM a8Dg== X-Forwarded-Encrypted: i=1; AHgh+Rpxsx/10URPniagbmG2UUl0wyPe7H6WzA3EJxaYuoNDjNyU3lNtNRgWwOws+D/RVqfdTcWSpxMUGjfSjmA=@vger.kernel.org X-Gm-Message-State: AOJu0YwxwM71iPpx431s7nHAKdTrudc2/L/QWCtatrrwqURkJmkjk6Rf BGqMUzFgSL2WEeLWLlPBlkClcSA5vvk6UIvtaTQvAqY4UQkSMN35RRYJ X-Gm-Gg: AfdE7cmpfiFLSbPnUic6gcWHarGT8ScVsuAZN+2E9NvvYdPgh6RVc//x6SouU/bpEzB KG9Pdyev313UzYCTlSp3PPKtDUcomF9KkkWHVbJ3DL/CE226vZ83uBox2h/EEIpjj8UXuiuNFVA giGP78SxVuiozS8jmneBgzoHZ9udCJ6e7v/N1EMSi8Fpqy2LXWb9iJ1nCXZVd99TxRmHRAYvQA+ FbcwIJz7rtN+Gq0IAH1BPNOFYvcHHMi25JHU7JL4ZhiNwqOeixSOmU9xbr0J5+E7IiFVMEnMC7M Ugz85R3SgoWlyIGK7MCdU2KRpqywkO7a4uIKqtqSL6xNo96JHczuB36OJEEi1EEFhKd60BwQu7V a22gKnZmBoLlHKwt55pKmqvQHwPafFFjIRpiaEddFJ9sYoZ5pE4RmL808wTk3kn0Tecf1P2j63h n0j66jrbcLbvQR68OaY14HOBR+GSBkmdl0EF/Onfu12hZJMOc= X-Received: by 2002:a17:903:1a0e:b0:2ce:9439:59a5 with SMTP id d9443c01a7336-2ce9ef21831mr78809055ad.36.1783927873948; Mon, 13 Jul 2026 00:31:13 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ccc9bdb76asm97535925ad.12.2026.07.13.00.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 00:31:13 -0700 (PDT) From: phucduc.bui@gmail.com To: Mark Brown , Greg Kroah-Hartman , rafael@kernel.org Cc: Danilo Krummrich , linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, bui duc phuc Subject: [PATCH] regcache: disable cache_only before rewriting paging registers Date: Mon, 13 Jul 2026 14:30:58 +0700 Message-ID: <20260713073059.47914-1-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc 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 --- 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