Linux driver-core infrastructure
 help / color / mirror / Atom feed
* [PATCH] regmap: reject volatile update_bits() in cache-only mode
@ 2026-05-28  5:32 phucduc.bui
  2026-05-28  5:42 ` Greg Kroah-Hartman
  2026-05-28 14:16 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: phucduc.bui @ 2026-05-28  5:32 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman
  Cc: Rafael J . Wysocki, Danilo Krummrich, driver-core, linux-kernel,
	bui duc phuc

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

Prevent _regmap_update_bits() from accessing hardware when the register
map is in cache-only mode.

Unlike regmap_raw_read() and _regmap_read(), the volatile
_regmap_update_bits() fast path bypasses the cache_only check. This can
result in unexpected hardware accesses while the device is suspended.

Return -EBUSY to ensure behavior is consistent with other cache-only
access paths.

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

Compile-tested only.

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

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index b2b26f07f4e3..e6e022b02637 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -3257,6 +3257,9 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
 		*change = false;
 
 	if (regmap_volatile(map, reg) && map->reg_update_bits) {
+		if (map->cache_only)
+			return -EBUSY;
+
 		reg = regmap_reg_addr(map, reg);
 		ret = map->reg_update_bits(map->bus_context, reg, mask, val);
 		if (ret == 0 && change)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-29 23:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28  5:32 [PATCH] regmap: reject volatile update_bits() in cache-only mode phucduc.bui
2026-05-28  5:42 ` Greg Kroah-Hartman
2026-05-28  6:55   ` Bui Duc Phuc
2026-05-28 14:16 ` Mark Brown
2026-05-29 23:16   ` Bui Duc Phuc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox