Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8798975b authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branch 'regmap/topic/core' into regmap-next

parents 6cca6712 fcac0233
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ static int regcache_flat_init(struct regmap *map)
	int i;
	unsigned int *cache;

	map->cache = kzalloc(sizeof(unsigned int) * (map->max_register + 1),
	map->cache = kcalloc(map->max_register + 1, sizeof(unsigned int),
			     GFP_KERNEL);
	if (!map->cache)
		return -ENOMEM;
+3 −3
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ static int regcache_lzo_init(struct regmap *map)
	ret = 0;

	blkcount = regcache_lzo_block_count(map);
	map->cache = kzalloc(blkcount * sizeof *lzo_blocks,
	map->cache = kcalloc(blkcount, sizeof(*lzo_blocks),
			     GFP_KERNEL);
	if (!map->cache)
		return -ENOMEM;
@@ -152,7 +152,7 @@ static int regcache_lzo_init(struct regmap *map)
	 * that register.
	 */
	bmp_size = map->num_reg_defaults_raw;
	sync_bmp = kmalloc(BITS_TO_LONGS(bmp_size) * sizeof(long),
	sync_bmp = kmalloc_array(BITS_TO_LONGS(bmp_size), sizeof(long),
				 GFP_KERNEL);
	if (!sync_bmp) {
		ret = -ENOMEM;
+5 −4
Original line number Diff line number Diff line
@@ -361,13 +361,14 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)
		rbnode->base_reg = reg;
	}

	rbnode->block = kmalloc(rbnode->blklen * map->cache_word_size,
	rbnode->block = kmalloc_array(rbnode->blklen, map->cache_word_size,
				      GFP_KERNEL);
	if (!rbnode->block)
		goto err_free;

	rbnode->cache_present = kzalloc(BITS_TO_LONGS(rbnode->blklen) *
		sizeof(*rbnode->cache_present), GFP_KERNEL);
	rbnode->cache_present = kcalloc(BITS_TO_LONGS(rbnode->blklen),
					sizeof(*rbnode->cache_present),
					GFP_KERNEL);
	if (!rbnode->cache_present)
		goto err_free_block;

+7 −6
Original line number Diff line number Diff line
@@ -386,23 +386,23 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
	if (!d)
		return -ENOMEM;

	d->status_buf = kzalloc(sizeof(unsigned int) * chip->num_regs,
	d->status_buf = kcalloc(chip->num_regs, sizeof(unsigned int),
				GFP_KERNEL);
	if (!d->status_buf)
		goto err_alloc;

	d->mask_buf = kzalloc(sizeof(unsigned int) * chip->num_regs,
	d->mask_buf = kcalloc(chip->num_regs, sizeof(unsigned int),
			      GFP_KERNEL);
	if (!d->mask_buf)
		goto err_alloc;

	d->mask_buf_def = kzalloc(sizeof(unsigned int) * chip->num_regs,
	d->mask_buf_def = kcalloc(chip->num_regs, sizeof(unsigned int),
				  GFP_KERNEL);
	if (!d->mask_buf_def)
		goto err_alloc;

	if (chip->wake_base) {
		d->wake_buf = kzalloc(sizeof(unsigned int) * chip->num_regs,
		d->wake_buf = kcalloc(chip->num_regs, sizeof(unsigned int),
				      GFP_KERNEL);
		if (!d->wake_buf)
			goto err_alloc;
@@ -422,8 +422,9 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,

	if (!map->use_single_read && map->reg_stride == 1 &&
	    d->irq_reg_stride == 1) {
		d->status_reg_buf = kmalloc(map->format.val_bytes *
					    chip->num_regs, GFP_KERNEL);
		d->status_reg_buf = kmalloc_array(chip->num_regs,
						  map->format.val_bytes,
						  GFP_KERNEL);
		if (!d->status_reg_buf)
			goto err_alloc;
	}
+8 −8
Original line number Diff line number Diff line
@@ -1513,7 +1513,7 @@ int regmap_write(struct regmap *map, unsigned int reg, unsigned int val)
{
	int ret;

	if (reg % map->reg_stride)
	if (!IS_ALIGNED(reg, map->reg_stride))
		return -EINVAL;

	map->lock(map->lock_arg);
@@ -1540,7 +1540,7 @@ int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val)
{
	int ret;

	if (reg % map->reg_stride)
	if (!IS_ALIGNED(reg, map->reg_stride))
		return -EINVAL;

	map->lock(map->lock_arg);
@@ -1714,7 +1714,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,

	if (map->bus && !map->format.parse_inplace)
		return -EINVAL;
	if (reg % map->reg_stride)
	if (!IS_ALIGNED(reg, map->reg_stride))
		return -EINVAL;

	/*
@@ -1983,7 +1983,7 @@ static int _regmap_multi_reg_write(struct regmap *map,
			int reg = regs[i].reg;
			if (!map->writeable_reg(map->dev, reg))
				return -EINVAL;
			if (reg % map->reg_stride)
			if (!IS_ALIGNED(reg, map->reg_stride))
				return -EINVAL;
		}

@@ -2133,7 +2133,7 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg,

	if (val_len % map->format.val_bytes)
		return -EINVAL;
	if (reg % map->reg_stride)
	if (!IS_ALIGNED(reg, map->reg_stride))
		return -EINVAL;

	map->lock(map->lock_arg);
@@ -2260,7 +2260,7 @@ int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val)
{
	int ret;

	if (reg % map->reg_stride)
	if (!IS_ALIGNED(reg, map->reg_stride))
		return -EINVAL;

	map->lock(map->lock_arg);
@@ -2296,7 +2296,7 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
		return -EINVAL;
	if (val_len % map->format.val_bytes)
		return -EINVAL;
	if (reg % map->reg_stride)
	if (!IS_ALIGNED(reg, map->reg_stride))
		return -EINVAL;
	if (val_count == 0)
		return -EINVAL;
@@ -2414,7 +2414,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
	size_t val_bytes = map->format.val_bytes;
	bool vol = regmap_volatile_range(map, reg, val_count);

	if (reg % map->reg_stride)
	if (!IS_ALIGNED(reg, map->reg_stride))
		return -EINVAL;

	if (map->bus && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) {
Loading