diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-18 11:53:00 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-20 15:56:34 -0500 |
commit | 4c691664583ef6a91f9ed0e08a75fbd30a5ffd5c (patch) | |
tree | 78f9234a8329352e1150ebc5409fe57171dff154 /drivers/base | |
parent | b44d48c1ccf70273a91b7d3a920b0b54c3cb314f (diff) |
regmap: Remove indexed cache type
There should be no situation where it offers any advantage over rbtree
and there are no current users so remove the code for simplicity.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/Makefile | 2 | ||||
-rw-r--r-- | drivers/base/regmap/internal.h | 3 | ||||
-rw-r--r-- | drivers/base/regmap/regcache-indexed.c | 64 | ||||
-rw-r--r-- | drivers/base/regmap/regcache.c | 20 |
4 files changed, 1 insertions, 88 deletions
diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile index 3dbe5d3ff227..defd57963c84 100644 --- a/drivers/base/regmap/Makefile +++ b/drivers/base/regmap/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-$(CONFIG_REGMAP) += regmap.o regcache.o regcache-indexed.o | 1 | obj-$(CONFIG_REGMAP) += regmap.o regcache.o |
2 | obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o | 2 | obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o |
3 | obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o | 3 | obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o |
4 | obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o | 4 | obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o |
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 954f7b73238f..1a02b7537c8b 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h | |||
@@ -119,10 +119,7 @@ unsigned int regcache_get_val(const void *base, unsigned int idx, | |||
119 | bool regcache_set_val(void *base, unsigned int idx, | 119 | bool regcache_set_val(void *base, unsigned int idx, |
120 | unsigned int val, unsigned int word_size); | 120 | unsigned int val, unsigned int word_size); |
121 | int regcache_lookup_reg(struct regmap *map, unsigned int reg); | 121 | int regcache_lookup_reg(struct regmap *map, unsigned int reg); |
122 | int regcache_insert_reg(struct regmap *map, unsigned int reg, | ||
123 | unsigned int val); | ||
124 | 122 | ||
125 | extern struct regcache_ops regcache_indexed_ops; | ||
126 | extern struct regcache_ops regcache_rbtree_ops; | 123 | extern struct regcache_ops regcache_rbtree_ops; |
127 | extern struct regcache_ops regcache_lzo_ops; | 124 | extern struct regcache_ops regcache_lzo_ops; |
128 | 125 | ||
diff --git a/drivers/base/regmap/regcache-indexed.c b/drivers/base/regmap/regcache-indexed.c deleted file mode 100644 index 507731ad8ec1..000000000000 --- a/drivers/base/regmap/regcache-indexed.c +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * Register cache access API - indexed caching support | ||
3 | * | ||
4 | * Copyright 2011 Wolfson Microelectronics plc | ||
5 | * | ||
6 | * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/slab.h> | ||
14 | |||
15 | #include "internal.h" | ||
16 | |||
17 | static int regcache_indexed_read(struct regmap *map, unsigned int reg, | ||
18 | unsigned int *value) | ||
19 | { | ||
20 | int ret; | ||
21 | |||
22 | ret = regcache_lookup_reg(map, reg); | ||
23 | if (ret >= 0) | ||
24 | *value = map->reg_defaults[ret].def; | ||
25 | |||
26 | return ret; | ||
27 | } | ||
28 | |||
29 | static int regcache_indexed_write(struct regmap *map, unsigned int reg, | ||
30 | unsigned int value) | ||
31 | { | ||
32 | int ret; | ||
33 | |||
34 | ret = regcache_lookup_reg(map, reg); | ||
35 | if (ret < 0) | ||
36 | return regcache_insert_reg(map, reg, value); | ||
37 | map->reg_defaults[ret].def = value; | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static int regcache_indexed_sync(struct regmap *map) | ||
42 | { | ||
43 | unsigned int i; | ||
44 | int ret; | ||
45 | |||
46 | for (i = 0; i < map->num_reg_defaults; i++) { | ||
47 | ret = _regmap_write(map, map->reg_defaults[i].reg, | ||
48 | map->reg_defaults[i].def); | ||
49 | if (ret < 0) | ||
50 | return ret; | ||
51 | dev_dbg(map->dev, "Synced register %#x, value %#x\n", | ||
52 | map->reg_defaults[i].reg, | ||
53 | map->reg_defaults[i].def); | ||
54 | } | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | struct regcache_ops regcache_indexed_ops = { | ||
59 | .type = REGCACHE_INDEXED, | ||
60 | .name = "indexed", | ||
61 | .read = regcache_indexed_read, | ||
62 | .write = regcache_indexed_write, | ||
63 | .sync = regcache_indexed_sync | ||
64 | }; | ||
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index e21eebd36afa..1ca2d7a1051f 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include "internal.h" | 19 | #include "internal.h" |
20 | 20 | ||
21 | static const struct regcache_ops *cache_types[] = { | 21 | static const struct regcache_ops *cache_types[] = { |
22 | ®cache_indexed_ops, | ||
23 | ®cache_rbtree_ops, | 22 | ®cache_rbtree_ops, |
24 | ®cache_lzo_ops, | 23 | ®cache_lzo_ops, |
25 | }; | 24 | }; |
@@ -420,22 +419,3 @@ int regcache_lookup_reg(struct regmap *map, unsigned int reg) | |||
420 | else | 419 | else |
421 | return -ENOENT; | 420 | return -ENOENT; |
422 | } | 421 | } |
423 | |||
424 | int regcache_insert_reg(struct regmap *map, unsigned int reg, | ||
425 | unsigned int val) | ||
426 | { | ||
427 | void *tmp; | ||
428 | |||
429 | tmp = krealloc(map->reg_defaults, | ||
430 | (map->num_reg_defaults + 1) * sizeof(struct reg_default), | ||
431 | GFP_KERNEL); | ||
432 | if (!tmp) | ||
433 | return -ENOMEM; | ||
434 | map->reg_defaults = tmp; | ||
435 | map->num_reg_defaults++; | ||
436 | map->reg_defaults[map->num_reg_defaults - 1].reg = reg; | ||
437 | map->reg_defaults[map->num_reg_defaults - 1].def = val; | ||
438 | sort(map->reg_defaults, map->num_reg_defaults, | ||
439 | sizeof(struct reg_default), regcache_default_cmp, NULL); | ||
440 | return 0; | ||
441 | } | ||