diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-15 16:20:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-09-15 16:20:56 -0700 |
commit | 2324067fa9a41b2d0b6ddbc7ac0497d105593b76 (patch) | |
tree | ec7a455c54bbfc78b148e74b566d114f20ec0810 | |
parent | b92178623f190a9898fed3632fb40b17f6789673 (diff) | |
parent | ffff7a12ace24c54220631b79abb02ab65780b5a (diff) | |
download | linux-2324067fa9a41b2d0b6ddbc7ac0497d105593b76.tar.gz linux-2324067fa9a41b2d0b6ddbc7ac0497d105593b76.tar.bz2 linux-2324067fa9a41b2d0b6ddbc7ac0497d105593b76.zip |
Merge tag 'regmap-v3.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap fix from Mark Brown:
"Fix registers file in debugfs
Ensure that the mode reported for the registers file in debugfs is
accurate by marking it as read only when the define to enable writes
has not been set. This is on the edge of being a bug fix but it's
debugfs and it makes it much easier for users to spot what's going
wrong when they forget to enable writeability"
* tag 'regmap-v3.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
regmap: Fix debugfs-file 'registers' mode
-rw-r--r-- | drivers/base/regmap/regmap-debugfs.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 65ea7b256b3e..0c94b661c16f 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name) map, ®map_reg_ranges_fops); if (map->max_register || regmap_readable(map, 0)) { - debugfs_create_file("registers", 0400, map->debugfs, + umode_t registers_mode; + + if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS)) + registers_mode = 0600; + else + registers_mode = 0400; + + debugfs_create_file("registers", registers_mode, map->debugfs, map, ®map_map_fops); debugfs_create_file("access", 0400, map->debugfs, map, ®map_access_fops); |