Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302083
b: refs/heads/master
c: 8614419
h: refs/heads/master
i:
  302081: fd303f7
  302079: efcea51
v: v3
  • Loading branch information
Mark Brown committed May 13, 2012
1 parent 2a6b452 commit 43d2e83
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 406 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 72b39f6f2b5a6b0beff14b80bed9756f151218a9
refs/heads/master: 8614419451d88bf99fff7f5e468fe45f8450891e
3 changes: 0 additions & 3 deletions trunk/drivers/base/regmap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ config REGMAP_I2C
config REGMAP_SPI
tristate

config REGMAP_MMIO
tristate

config REGMAP_IRQ
bool
1 change: 0 additions & 1 deletion trunk/drivers/base/regmap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o
obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o
obj-$(CONFIG_REGMAP_MMIO) += regmap-mmio.o
obj-$(CONFIG_REGMAP_IRQ) += regmap-irq.o
10 changes: 1 addition & 9 deletions trunk/drivers/base/regmap/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,13 @@ struct regmap_format {
unsigned int (*parse_val)(void *buf);
};

typedef void (*regmap_lock)(struct regmap *map);
typedef void (*regmap_unlock)(struct regmap *map);

struct regmap {
struct mutex mutex;
spinlock_t spinlock;
regmap_lock lock;
regmap_unlock unlock;
struct mutex lock;

struct device *dev; /* Device we do I/O on */
void *work_buf; /* Scratch buffer used to format I/O */
struct regmap_format format; /* Buffer format */
const struct regmap_bus *bus;
void *bus_context;
const char *name;

#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/base/regmap/regcache-rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static int rbtree_show(struct seq_file *s, void *ignored)
int nodes = 0;
int registers = 0;

map->lock(map);
mutex_lock(&map->lock);

for (node = rb_first(&rbtree_ctx->root); node != NULL;
node = rb_next(node)) {
Expand All @@ -155,7 +155,7 @@ static int rbtree_show(struct seq_file *s, void *ignored)
seq_printf(s, "%d nodes, %d registers, average %d registers\n",
nodes, registers, registers / nodes);

map->unlock(map);
mutex_unlock(&map->lock);

return 0;
}
Expand Down
20 changes: 10 additions & 10 deletions trunk/drivers/base/regmap/regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int regcache_sync(struct regmap *map)

BUG_ON(!map->cache_ops || !map->cache_ops->sync);

map->lock(map);
mutex_lock(&map->lock);
/* Remember the initial bypass state */
bypass = map->cache_bypass;
dev_dbg(map->dev, "Syncing %s cache\n",
Expand Down Expand Up @@ -296,7 +296,7 @@ int regcache_sync(struct regmap *map)
trace_regcache_sync(map->dev, name, "stop");
/* Restore the bypass state */
map->cache_bypass = bypass;
map->unlock(map);
mutex_unlock(&map->lock);

return ret;
}
Expand All @@ -323,7 +323,7 @@ int regcache_sync_region(struct regmap *map, unsigned int min,

BUG_ON(!map->cache_ops || !map->cache_ops->sync);

map->lock(map);
mutex_lock(&map->lock);

/* Remember the initial bypass state */
bypass = map->cache_bypass;
Expand All @@ -342,7 +342,7 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
trace_regcache_sync(map->dev, name, "stop region");
/* Restore the bypass state */
map->cache_bypass = bypass;
map->unlock(map);
mutex_unlock(&map->lock);

return ret;
}
Expand All @@ -361,11 +361,11 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
*/
void regcache_cache_only(struct regmap *map, bool enable)
{
map->lock(map);
mutex_lock(&map->lock);
WARN_ON(map->cache_bypass && enable);
map->cache_only = enable;
trace_regmap_cache_only(map->dev, enable);
map->unlock(map);
mutex_unlock(&map->lock);
}
EXPORT_SYMBOL_GPL(regcache_cache_only);

Expand All @@ -380,9 +380,9 @@ EXPORT_SYMBOL_GPL(regcache_cache_only);
*/
void regcache_mark_dirty(struct regmap *map)
{
map->lock(map);
mutex_lock(&map->lock);
map->cache_dirty = true;
map->unlock(map);
mutex_unlock(&map->lock);
}
EXPORT_SYMBOL_GPL(regcache_mark_dirty);

Expand All @@ -399,11 +399,11 @@ EXPORT_SYMBOL_GPL(regcache_mark_dirty);
*/
void regcache_cache_bypass(struct regmap *map, bool enable)
{
map->lock(map);
mutex_lock(&map->lock);
WARN_ON(map->cache_only && enable);
map->cache_bypass = enable;
trace_regmap_cache_bypass(map->dev, enable);
map->unlock(map);
mutex_unlock(&map->lock);
}
EXPORT_SYMBOL_GPL(regcache_cache_bypass);

Expand Down
13 changes: 5 additions & 8 deletions trunk/drivers/base/regmap/regmap-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
#include <linux/module.h>
#include <linux/init.h>

static int regmap_i2c_write(void *context, const void *data, size_t count)
static int regmap_i2c_write(struct device *dev, const void *data, size_t count)
{
struct device *dev = context;
struct i2c_client *i2c = to_i2c_client(dev);
int ret;

Expand All @@ -30,11 +29,10 @@ static int regmap_i2c_write(void *context, const void *data, size_t count)
return -EIO;
}

static int regmap_i2c_gather_write(void *context,
static int regmap_i2c_gather_write(struct device *dev,
const void *reg, size_t reg_size,
const void *val, size_t val_size)
{
struct device *dev = context;
struct i2c_client *i2c = to_i2c_client(dev);
struct i2c_msg xfer[2];
int ret;
Expand Down Expand Up @@ -64,11 +62,10 @@ static int regmap_i2c_gather_write(void *context,
return -EIO;
}

static int regmap_i2c_read(void *context,
static int regmap_i2c_read(struct device *dev,
const void *reg, size_t reg_size,
void *val, size_t val_size)
{
struct device *dev = context;
struct i2c_client *i2c = to_i2c_client(dev);
struct i2c_msg xfer[2];
int ret;
Expand Down Expand Up @@ -110,7 +107,7 @@ static struct regmap_bus regmap_i2c = {
struct regmap *regmap_init_i2c(struct i2c_client *i2c,
const struct regmap_config *config)
{
return regmap_init(&i2c->dev, &regmap_i2c, &i2c->dev, config);
return regmap_init(&i2c->dev, &regmap_i2c, config);
}
EXPORT_SYMBOL_GPL(regmap_init_i2c);

Expand All @@ -127,7 +124,7 @@ EXPORT_SYMBOL_GPL(regmap_init_i2c);
struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
const struct regmap_config *config)
{
return devm_regmap_init(&i2c->dev, &regmap_i2c, &i2c->dev, config);
return devm_regmap_init(&i2c->dev, &regmap_i2c, config);
}
EXPORT_SYMBOL_GPL(devm_regmap_init_i2c);

Expand Down
Loading

0 comments on commit 43d2e83

Please sign in to comment.