aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-06-10 23:57:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-06-10 23:57:43 -0400
commitb0a4c6f2e3fce088eb597d4b9ee2075cb6399ee1 (patch)
tree6f0a4e5bb74f4a143433f8b01982110fc254aa3b
parent68d7d768c684a74487dfbdbf100432685e54dc0b (diff)
parent752a6a5f84bfed18d0709383913d9d9d21b61c77 (diff)
Merge tag 'regmap-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap fixes from Mark Brown: "Nothing too exciting - a cleanup for debugfs in error handling and a fix for the padding (which has only just acquired real use) and exporting a function that's supposed to be usable by drivers." * tag 'regmap-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: Export regmap_reinit_cache() regmap: Fix the size calculation for map->format.buf_size regmap: clean up debugfs if regmap_init fails
-rw-r--r--drivers/base/regmap/regmap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 0bcda488f11..c89aa01fb1d 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -246,11 +246,11 @@ struct regmap *regmap_init(struct device *dev,
246 map->lock = regmap_lock_mutex; 246 map->lock = regmap_lock_mutex;
247 map->unlock = regmap_unlock_mutex; 247 map->unlock = regmap_unlock_mutex;
248 } 248 }
249 map->format.buf_size = (config->reg_bits + config->val_bits) / 8;
250 map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8); 249 map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8);
251 map->format.pad_bytes = config->pad_bits / 8; 250 map->format.pad_bytes = config->pad_bits / 8;
252 map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8); 251 map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8);
253 map->format.buf_size += map->format.pad_bytes; 252 map->format.buf_size = DIV_ROUND_UP(config->reg_bits +
253 config->val_bits + config->pad_bits, 8);
254 map->reg_shift = config->pad_bits % 8; 254 map->reg_shift = config->pad_bits % 8;
255 if (config->reg_stride) 255 if (config->reg_stride)
256 map->reg_stride = config->reg_stride; 256 map->reg_stride = config->reg_stride;
@@ -368,7 +368,7 @@ struct regmap *regmap_init(struct device *dev,
368 368
369 ret = regcache_init(map, config); 369 ret = regcache_init(map, config);
370 if (ret < 0) 370 if (ret < 0)
371 goto err_free_workbuf; 371 goto err_debugfs;
372 372
373 /* Add a devres resource for dev_get_regmap() */ 373 /* Add a devres resource for dev_get_regmap() */
374 m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL); 374 m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL);
@@ -383,7 +383,8 @@ struct regmap *regmap_init(struct device *dev,
383 383
384err_cache: 384err_cache:
385 regcache_exit(map); 385 regcache_exit(map);
386err_free_workbuf: 386err_debugfs:
387 regmap_debugfs_exit(map);
387 kfree(map->work_buf); 388 kfree(map->work_buf);
388err_map: 389err_map:
389 kfree(map); 390 kfree(map);
@@ -471,6 +472,7 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
471 472
472 return ret; 473 return ret;
473} 474}
475EXPORT_SYMBOL_GPL(regmap_reinit_cache);
474 476
475/** 477/**
476 * regmap_exit(): Free a previously allocated register map 478 * regmap_exit(): Free a previously allocated register map