From: Markus Pargmann Date: Mon, 8 Sep 2014 06:43:37 +0000 (+0200) Subject: regmap: Fix debugfs-file 'registers' mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=18c0301f9898feaac38135b2cea476bb606830e3;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Signed-off-by: Mark Brown --- diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index bdd88708e4d6..a88cbd42edf0 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -516,7 +516,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);