提交 ffff7a12 编写于 作者: M Markus Pargmann 提交者: Mark Brown

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: NMarkus Pargmann <mpa@pengutronix.de>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 7d1311b9
...@@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name) ...@@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
map, &regmap_reg_ranges_fops); map, &regmap_reg_ranges_fops);
if (map->max_register || regmap_readable(map, 0)) { 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, &regmap_map_fops); map, &regmap_map_fops);
debugfs_create_file("access", 0400, map->debugfs, debugfs_create_file("access", 0400, map->debugfs,
map, &regmap_access_fops); map, &regmap_access_fops);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册