From: Mark Brown Date: Tue, 22 Feb 2022 21:43:31 +0000 (+0000) Subject: power: supply: Use an rbtree rather than flat register cache X-Git-Tag: v6.1-rc5~1723^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c678b7a6442c1d2d137639b2b6730f0587a956d;p=platform%2Fkernel%2Flinux-starfive.git power: supply: Use an rbtree rather than flat register cache 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 Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c index d56e469..1511f71 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 = {