Re: [PATCH 3/6] regmap: Add the rbtree cache support

From: Lars-Peter Clausen
Date: Mon Sep 05 2011 - 12:15:59 EST


On 09/05/2011 03:50 PM, Dimitris Papastamos wrote:
> [...]
> +
> +static int regcache_rbtree_init(struct regmap *map)
> +{
> + struct regcache_rbtree_ctx *rbtree_ctx;
> + int i;
> + int ret;
> +
> + map->cache = kmalloc(sizeof *rbtree_ctx, GFP_KERNEL);
> + if (!map->cache)
> + return -ENOMEM;
> +
> + rbtree_ctx = map->cache;
> + rbtree_ctx->root = RB_ROOT;
> + rbtree_ctx->cached_rbnode = NULL;
> +
> + for (i = 0; i < map->num_cache_defaults; i++) {
> + ret = regcache_rbtree_write(map,
> + map->cache_defaults[ret].reg,
> + map->cache_defaults[ret].def);

map->cache_defaults[i]

> + if (ret)
> + goto err;
> + }
> +
> + return 0;
> +
> +err:
> + regcache_exit(map);
> + return ret;
> +}
> [...]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/