public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regmap: Add a config option for making regmap debugfs writable
@ 2015-10-13 17:46 Anatol Pomozov
  2015-10-13 17:55 ` Mark Brown
  2015-10-13 20:00 ` kbuild test robot
  0 siblings, 2 replies; 7+ messages in thread
From: Anatol Pomozov @ 2015-10-13 17:46 UTC (permalink / raw)
  To: linux-kernel, broonie; +Cc: Anatol Pomozov

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-05 16:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 17:46 [PATCH] regmap: Add a config option for making regmap debugfs writable Anatol Pomozov
2015-10-13 17:55 ` Mark Brown
2015-10-13 18:33   ` Anatol Pomozov
2015-10-13 20:07     ` Mark Brown
2015-12-04 16:37       ` Pavel Machek
2015-12-05 16:49         ` Mark Brown
2015-10-13 20:00 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox