Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305618
b: refs/heads/master
c: 4b5c018
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Warren authored and Mark Brown committed Apr 13, 2012
1 parent da9f727 commit 63586ba
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 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: 2690dfdb05abf3a8e11ff21ec12dbbe620a026fb
refs/heads/master: 4b5c0186e48c8d14fd7c38ff99b8d1b9aa475432
3 changes: 2 additions & 1 deletion trunk/drivers/base/regmap/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct regmap {

#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs;
const char *debugfs_name;
#endif

unsigned int max_register;
Expand Down Expand Up @@ -111,7 +112,7 @@ int _regmap_write(struct regmap *map, unsigned int reg,

#ifdef CONFIG_DEBUG_FS
extern void regmap_debugfs_initcall(void);
extern void regmap_debugfs_init(struct regmap *map);
extern void regmap_debugfs_init(struct regmap *map, const char *name);
extern void regmap_debugfs_exit(struct regmap *map);
#else
static inline void regmap_debugfs_initcall(void) { }
Expand Down
14 changes: 11 additions & 3 deletions trunk/drivers/base/regmap/regmap-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,17 @@ static const struct file_operations regmap_access_fops = {
.llseek = default_llseek,
};

void regmap_debugfs_init(struct regmap *map)
void regmap_debugfs_init(struct regmap *map, const char *name)
{
map->debugfs = debugfs_create_dir(dev_name(map->dev),
regmap_debugfs_root);
if (name) {
map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
dev_name(map->dev), name);
name = map->debugfs_name;
} else {
name = dev_name(map->dev);
}

map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
if (!map->debugfs) {
dev_warn(map->dev, "Failed to create debugfs directory\n");
return;
Expand Down Expand Up @@ -274,6 +281,7 @@ void regmap_debugfs_init(struct regmap *map)
void regmap_debugfs_exit(struct regmap *map)
{
debugfs_remove_recursive(map->debugfs);
kfree(map->debugfs_name);
}

void regmap_debugfs_initcall(void)
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ struct regmap *regmap_init(struct device *dev,
goto err_map;
}

regmap_debugfs_init(map);
regmap_debugfs_init(map, config->name);

ret = regcache_init(map, config);
if (ret < 0)
Expand Down Expand Up @@ -431,7 +431,7 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
map->precious_reg = config->precious_reg;
map->cache_type = config->cache_type;

regmap_debugfs_init(map);
regmap_debugfs_init(map, config->name);

map->cache_bypass = false;
map->cache_only = false;
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/regmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ struct reg_default {
/**
* Configuration for the register map of a device.
*
* @name: Optional name of the regmap. Useful when a device has multiple
* register regions.
*
* @reg_bits: Number of bits in a register address, mandatory.
* @pad_bits: Number of bits of padding between register and value.
* @val_bits: Number of bits in a register value, mandatory.
Expand Down Expand Up @@ -77,6 +80,8 @@ struct reg_default {
* @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
*/
struct regmap_config {
const char *name;

int reg_bits;
int pad_bits;
int val_bits;
Expand Down

0 comments on commit 63586ba

Please sign in to comment.