From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756564AbdLVRmN (ORCPT ); Fri, 22 Dec 2017 12:42:13 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:40249 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756383AbdLVRmM (ORCPT ); Fri, 22 Dec 2017 12:42:12 -0500 X-Google-Smtp-Source: ACJfBovdVb/STMsvFJfCT2w3lGLOhTBb4Zuj0eNYxOQV56dxcRD2A8ot0FJ8cBgAHOC475gRrIDblQ== From: Bartosz Golaszewski To: Mark Brown , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH] regmap: debugfs: document why we don't create the debugfs entries Date: Fri, 22 Dec 2017 18:42:08 +0100 Message-Id: <20171222174208.4126-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.15.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/base/regmap/regmap-debugfs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index ae962b756863..f3266334063e 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; -- 2.15.1