Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] power: supply: Use an rbtree rather than flat register cache
@ 2022-02-22 21:43 Mark Brown
  2022-02-24 10:54 ` Sebastian Reichel
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Mark Brown @ 2022-02-22 21:43 UTC (permalink / raw)
  To: Dmitry Osipenko, Sebastian Reichel; +Cc: linux-pm, Mark Brown

The smb347 has a very sparse register map (the maximum register is 0x3f but
less than 10% of the possible registers appear to be defined) and doesn't
have any hardware defaults specified so the sparser data structure of an
rbtree is a better fit for it's needs than a flat cache. Since it uses I2C
for the control interface there is no performance concern with the slightly
more involved code so let's convert it.

This will mean we avoid any issues created by assuming that any previously
unaccessed registers hold a value that doesn't match what's in the hardware
(eg, an _update_bits() suppressing a write).

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/power/supply/smb347-charger.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c
index d56e469043bb..1511f71f937c 100644
--- a/drivers/power/supply/smb347-charger.c
+++ b/drivers/power/supply/smb347-charger.c
@@ -1488,8 +1488,7 @@ static const struct regmap_config smb347_regmap = {
 	.max_register	= SMB347_MAX_REGISTER,
 	.volatile_reg	= smb347_volatile_reg,
 	.readable_reg	= smb347_readable_reg,
-	.cache_type	= REGCACHE_FLAT,
-	.num_reg_defaults_raw = SMB347_MAX_REGISTER,
+	.cache_type	= REGCACHE_RBTREE,
 };
 
 static const struct regulator_ops smb347_usb_vbus_regulator_ops = {
-- 
2.30.2


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

end of thread, other threads:[~2022-02-24 14:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22 21:43 [PATCH] power: supply: Use an rbtree rather than flat register cache Mark Brown
2022-02-24 10:54 ` Sebastian Reichel
2022-02-24 11:07 ` Dmitry Osipenko
2022-02-24 11:35   ` Dmitry Osipenko
2022-02-24 12:08     ` Mark Brown
2022-02-24 14:10       ` Dmitry Osipenko
2022-02-24 11:45   ` Mark Brown
2022-02-24 14:58 ` Dmitry Osipenko

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