Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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).

+5 -6
+1 -1
drivers/base/regmap/regcache.c
··· 154 154 map->num_reg_defaults = config->num_reg_defaults; 155 155 map->num_reg_defaults_raw = config->num_reg_defaults_raw; 156 156 map->reg_defaults_raw = config->reg_defaults_raw; 157 - map->cache_word_size = DIV_ROUND_UP(config->val_bits, 8); 157 + map->cache_word_size = BITS_TO_BYTES(config->val_bits); 158 158 map->cache_size_raw = map->cache_word_size * config->num_reg_defaults_raw; 159 159 160 160 map->cache = NULL;
+4 -5
drivers/base/regmap/regmap.c
··· 758 758 map->alloc_flags = GFP_KERNEL; 759 759 760 760 map->reg_base = config->reg_base; 761 + map->reg_shift = config->pad_bits % 8; 761 762 762 - map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8); 763 763 map->format.pad_bytes = config->pad_bits / 8; 764 764 map->format.reg_shift = config->reg_shift; 765 - map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8); 766 - map->format.buf_size = DIV_ROUND_UP(config->reg_bits + 767 - config->val_bits + config->pad_bits, 8); 768 - map->reg_shift = config->pad_bits % 8; 765 + map->format.reg_bytes = BITS_TO_BYTES(config->reg_bits); 766 + map->format.val_bytes = BITS_TO_BYTES(config->val_bits); 767 + map->format.buf_size = BITS_TO_BYTES(config->reg_bits + config->val_bits + config->pad_bits); 769 768 if (config->reg_stride) 770 769 map->reg_stride = config->reg_stride; 771 770 else