aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2014-09-08 02:43:37 -0400
committerMark Brown <broonie@kernel.org>2014-09-08 07:16:19 -0400
commitffff7a12ace24c54220631b79abb02ab65780b5a (patch)
treef1e7f9552f32c3412a6b7e27606a72e79fbebbd2
parent7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff)
regmap: Fix debugfs-file 'registers' mode
The macro "REGMAP_ALLOW_WRITE_DEBUGFS" can be used to enable write support on the registers file in the debugfs. The mode of the file is fixed to 0400 so it is not possible to write the file ever. This patch fixes the mode by setting it to the correct value depending on the macro. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/base/regmap/regmap-debugfs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 45d812c0ea77..9c9255142079 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)
512 map, &regmap_reg_ranges_fops); 512 map, &regmap_reg_ranges_fops);
513 513
514 if (map->max_register || regmap_readable(map, 0)) { 514 if (map->max_register || regmap_readable(map, 0)) {
515 debugfs_create_file("registers", 0400, map->debugfs, 515 umode_t registers_mode;
516
517 if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS))
518 registers_mode = 0600;
519 else
520 registers_mode = 0400;
521
522 debugfs_create_file("registers", registers_mode, map->debugfs,
516 map, &regmap_map_fops); 523 map, &regmap_map_fops);
517 debugfs_create_file("access", 0400, map->debugfs, 524 debugfs_create_file("access", 0400, map->debugfs,
518 map, &regmap_access_fops); 525 map, &regmap_access_fops);