[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251129142042.344359-3-richard@nod.at>
Date: Sat, 29 Nov 2025 15:20:40 +0100
From: Richard Weinberger <richard@....at>
To: linux-kernel@...r.kernel.org
Cc: linux-omap@...r.kernel.org,
devicetree@...r.kernel.org,
arnd@...db.de,
lee@...nel.org,
dakr@...nel.org,
rafael@...nel.org,
gregkh@...uxfoundation.org,
broonie@...nel.org,
tony@...mide.com,
rogerq@...nel.org,
khilman@...libre.com,
andreas@...nade.info,
aaro.koskinen@....fi,
conor+dt@...nel.org,
krzk+dt@...nel.org,
robh@...nel.org,
Richard Weinberger <richard@....at>
Subject: [PATCH 2/4] regmap: Allow disabling debugfs via regmap_config
Regmap already disables register access via debugfs as soon as a register
map is used without taking locks.
Go a step further and allow disabling debugfs via regmap_config such that
device drivers can decide on their own whether uncontrolled register access
via debugfs is harmful.
Signed-off-by: Richard Weinberger <richard@....at>
---
drivers/base/regmap/regmap.c | 2 ++
include/linux/regmap.h | 3 +++
2 files changed, 5 insertions(+)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ce9be3989a218..38d7a03aa7637 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -697,6 +697,8 @@ struct regmap *__regmap_init(struct device *dev,
if (ret)
goto err_map;
+ map->debugfs_disable = config->debugfs_disable;
+
ret = -EINVAL; /* Later error paths rely on this */
if (config->disable_locking) {
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 55343795644b9..646501a055eba 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -395,6 +395,7 @@ typedef void (*regmap_unlock)(void *);
*
* @ranges: Array of configuration entries for virtual address ranges.
* @num_ranges: Number of range configuration entries.
+ * @debugfs_disable: Disable debugfs access to this register.
*/
struct regmap_config {
const char *name;
@@ -467,6 +468,8 @@ struct regmap_config {
const struct regmap_range_cfg *ranges;
unsigned int num_ranges;
+
+ bool debugfs_disable;
};
/**
--
2.51.0
Powered by blists - more mailing lists