Re: [PATCH] regmap: Cut down on the average # of nodes in the rbtreecache

From: Mark Brown
Date: Wed Mar 13 2013 - 08:01:44 EST


On Wed, Mar 13, 2013 at 11:53:43AM +0000, Dimitris Papastamos wrote:

> + for (bitmap_size = 0, i = 0; i < map->num_reg_defaults; i++)
> + if (map->reg_defaults[i].reg > bitmap_size)
> + bitmap_size = map->reg_defaults[i].reg;
> + bitmap_size++;
> +
> + reg_bitmap = kmalloc(BITS_TO_LONGS(bitmap_size) * sizeof(long),
> + GFP_KERNEL);
> + if (!reg_bitmap) {
> + ret = -ENOMEM;
> + goto err;
> + }
> + bitmap_zero(reg_bitmap, bitmap_size);
> + rbtree_ctx->reg_bitmap = reg_bitmap;
> + rbtree_ctx->reg_bitmap_nbits = bitmap_size;
> +

What happens if we don't have any register defaults?

This also needs a clearer name reflecting the function rather than the
type of the data.

Attachment: signature.asc
Description: Digital signature