From: Anatol Pomozov <anatol.pomozov@gmail.com>
To: linux-kernel@vger.kernel.org, broonie@kernel.org
Cc: Anatol Pomozov <anatol.pomozov@gmail.com>
Subject: [PATCH] regmap: Add a config option for making regmap debugfs writable
Date: Tue, 13 Oct 2015 10:46:55 -0700 [thread overview]
Message-ID: <1444758415-5190-1-git-send-email-anatol.pomozov@gmail.com> (raw)
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
next reply other threads:[~2015-10-13 17:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 17:46 Anatol Pomozov [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444758415-5190-1-git-send-email-anatol.pomozov@gmail.com \
--to=anatol.pomozov@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®