From 8528bdd450d34687b380c0f87992d105bdf54ca3 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 9 Oct 2011 13:13:58 +0100 Subject: regmap: Allow caches for devices with no defaults We only really need the defaults in order to cut down the number of registers we sync and to satisfy reads while the device is powered off but not all devices are going to need to do that (always on devices like PMICs being the prime example) so don't require those devices to supply a default. Instead only try to fall back to hardware defaults if the driver told us to. Devices using LZO won't be able to instantiate with this, that will require some updates in the LZO code to handle this case. Signed-off-by: Mark Brown Acked-by: Dimitris Papastamos --- drivers/base/regmap/regcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/base/regmap') diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 409abd282c6c..afcfef838263 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -119,7 +119,7 @@ int regcache_init(struct regmap *map) if (!tmp_buf) return -ENOMEM; map->reg_defaults = tmp_buf; - } else { + } else if (map->num_reg_defaults_raw) { /* Some devices such as PMICs don't have cache defaults, * we cope with this by reading back the HW registers and * crafting the cache defaults by hand. -- cgit v1.2.3-59-g8ed1b