@@ -769,14 +769,13 @@ struct regmap *__regmap_init(struct device *dev,
769769 map -> alloc_flags = GFP_KERNEL ;
770770
771771 map -> reg_base = config -> reg_base ;
772+ map -> reg_shift = config -> pad_bits % 8 ;
772773
773- map -> format .reg_bytes = DIV_ROUND_UP (config -> reg_bits , 8 );
774774 map -> format .pad_bytes = config -> pad_bits / 8 ;
775775 map -> format .reg_shift = config -> reg_shift ;
776- map -> format .val_bytes = DIV_ROUND_UP (config -> val_bits , 8 );
777- map -> format .buf_size = DIV_ROUND_UP (config -> reg_bits +
778- config -> val_bits + config -> pad_bits , 8 );
779- map -> reg_shift = config -> pad_bits % 8 ;
776+ map -> format .reg_bytes = BITS_TO_BYTES (config -> reg_bits );
777+ map -> format .val_bytes = BITS_TO_BYTES (config -> val_bits );
778+ map -> format .buf_size = BITS_TO_BYTES (config -> reg_bits + config -> val_bits + config -> pad_bits );
780779 if (config -> reg_stride )
781780 map -> reg_stride = config -> reg_stride ;
782781 else
@@ -3116,7 +3115,7 @@ int regmap_fields_read(struct regmap_field *field, unsigned int id,
31163115EXPORT_SYMBOL_GPL (regmap_fields_read );
31173116
31183117static int _regmap_bulk_read (struct regmap * map , unsigned int reg ,
3119- unsigned int * regs , void * val , size_t val_count )
3118+ const unsigned int * regs , void * val , size_t val_count )
31203119{
31213120 u32 * u32 = val ;
31223121 u16 * u16 = val ;
@@ -3210,7 +3209,7 @@ EXPORT_SYMBOL_GPL(regmap_bulk_read);
32103209 * A value of zero will be returned on success, a negative errno will
32113210 * be returned in error cases.
32123211 */
3213- int regmap_multi_reg_read (struct regmap * map , unsigned int * regs , void * val ,
3212+ int regmap_multi_reg_read (struct regmap * map , const unsigned int * regs , void * val ,
32143213 size_t val_count )
32153214{
32163215 if (val_count == 0 )
0 commit comments