From: Bartosz Golaszewski Date: Fri, 22 Dec 2017 17:42:08 +0000 (+0100) Subject: regmap: debugfs: document why we don't create the debugfs entries X-Git-Tag: v4.16-rc1~186^2~1^5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=078711d7f88d33b0adebb402a1bcb2aa89afe68b;p=thirdparty%2Flinux.git regmap: debugfs: document why we don't create the debugfs entries This is a follow-up to commit a5ba91c380b8 ("regmap: debugfs: emit a debug message when locking is disabled"). I figured that a user may see this message, grep the code, come to this place and he still won't know why we actually disabled debugfs. Add a comment explaining the reason. Signed-off-by: Bartosz Golaszewski Signed-off-by: Mark Brown --- diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index ae962b7568639..f3266334063eb 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -529,6 +529,13 @@ void regmap_debugfs_init(struct regmap *map, const char *name) struct regmap_range_node *range_node; const char *devname = "dummy"; + /* + * Userspace can initiate reads from the hardware over debugfs. + * Normally internal regmap structures and buffers are protected with + * a mutex or a spinlock, but if the regmap owner decided to disable + * all locking mechanisms, this is no longer the case. For safety: + * don't create the debugfs entries if locking is disabled. + */ if (map->debugfs_disable) { dev_dbg(map->dev, "regmap locking disabled - not creating debugfs entries\n"); return;