mirror of
https://github.com/torvalds/linux.git
synced 2026-03-13 22:36:17 +01:00
regmap: Cleanup and microoptimization
Merge series from Andy Shevchenko <andriy.shevchenko@linux.intel.com>: Two patches move the code to use BITS_TO_BYTES(), while the last one otpimizes the code generation on x86 (32- and 64-bit on different compilers).
This commit is contained in:
commit
a308f9e47f
2 changed files with 5 additions and 6 deletions
|
|
@ -154,7 +154,7 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
|
|||
map->num_reg_defaults = config->num_reg_defaults;
|
||||
map->num_reg_defaults_raw = config->num_reg_defaults_raw;
|
||||
map->reg_defaults_raw = config->reg_defaults_raw;
|
||||
map->cache_word_size = DIV_ROUND_UP(config->val_bits, 8);
|
||||
map->cache_word_size = BITS_TO_BYTES(config->val_bits);
|
||||
map->cache_size_raw = map->cache_word_size * config->num_reg_defaults_raw;
|
||||
|
||||
map->cache = NULL;
|
||||
|
|
|
|||
|
|
@ -758,14 +758,13 @@ struct regmap *__regmap_init(struct device *dev,
|
|||
map->alloc_flags = GFP_KERNEL;
|
||||
|
||||
map->reg_base = config->reg_base;
|
||||
map->reg_shift = config->pad_bits % 8;
|
||||
|
||||
map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8);
|
||||
map->format.pad_bytes = config->pad_bits / 8;
|
||||
map->format.reg_shift = config->reg_shift;
|
||||
map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8);
|
||||
map->format.buf_size = DIV_ROUND_UP(config->reg_bits +
|
||||
config->val_bits + config->pad_bits, 8);
|
||||
map->reg_shift = config->pad_bits % 8;
|
||||
map->format.reg_bytes = BITS_TO_BYTES(config->reg_bits);
|
||||
map->format.val_bytes = BITS_TO_BYTES(config->val_bits);
|
||||
map->format.buf_size = BITS_TO_BYTES(config->reg_bits + config->val_bits + config->pad_bits);
|
||||
if (config->reg_stride)
|
||||
map->reg_stride = config->reg_stride;
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue