Messages in this thread Patch in this message | | | From | Anatol Pomozov <> | Subject | [PATCH] regmap: Add a config option for making regmap debugfs writable | Date | Tue, 13 Oct 2015 10:46:55 -0700 |
| |
Instead of modifiying source code directly one should use config files. It is the standard way to set compile-time options.
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> --- drivers/base/regmap/Kconfig | 6 ++++++ drivers/base/regmap/regmap-debugfs.c | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig index db9d00c3..579c8b5 100644 --- a/drivers/base/regmap/Kconfig +++ b/drivers/base/regmap/Kconfig @@ -9,6 +9,12 @@ config REGMAP select IRQ_DOMAIN if REGMAP_IRQ bool +config REGMAP_ALLOW_WRITE_DEBUGFS + bool "Make regmap debugfs writable" + default n + select REGMAP + select DEBUG_FS + config REGMAP_AC97 tristate diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 3f0a7e2..3ea2e27 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -259,8 +259,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, count, ppos); } -#undef REGMAP_ALLOW_WRITE_DEBUGFS -#ifdef REGMAP_ALLOW_WRITE_DEBUGFS +#ifdef CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS /* * This can be dangerous especially when we have clients such as * PMICs, therefore don't provide any real compile time configuration option @@ -595,7 +594,7 @@ void regmap_debugfs_init(struct regmap *map, const char *name) if (map->max_register || regmap_readable(map, 0)) { umode_t registers_mode; -#if defined(REGMAP_ALLOW_WRITE_DEBUGFS) +#ifdef CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS registers_mode = 0600; #else registers_mode = 0400; -- 2.6.0.rc2.230.g3dd15c0
| |