linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regmap: debugfs: Do not print warning when no device is associated
@ 2018-03-02 19:12 Fabio Estevam
  2018-03-05 16:17 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2018-03-02 19:12 UTC (permalink / raw)
  To: broonie; +Cc: david, linux-kernel, Fabio Estevam

From: Fabio Estevam <fabio.estevam@nxp.com>

Commit 9b947a13e7f6 ("regmap: use debugfs even when no device")
allows the usage of regmap debugfs even when there is no device
associated, which causes several warnings like this:

(NULL device *): Failed to create debugfs directory

Do not print the warning in the case there is no associated device. 

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/base/regmap/regmap-debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 7eb512b..db6141f 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -575,7 +575,9 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
 
 	map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
 	if (!map->debugfs) {
-		dev_warn(map->dev, "Failed to create debugfs directory\n");
+		if (map->dev)
+			dev_warn(map->dev,
+				 "Failed to create debugfs directory\n");
 		return;
 	}
 
-- 
2.7.4

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

* Re: [PATCH] regmap: debugfs: Do not print warning when no device is associated
  2018-03-02 19:12 [PATCH] regmap: debugfs: Do not print warning when no device is associated Fabio Estevam
@ 2018-03-05 16:17 ` Mark Brown
  2018-03-05 18:29   ` Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2018-03-05 16:17 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: david, linux-kernel, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

On Fri, Mar 02, 2018 at 04:12:40PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>

> Commit 9b947a13e7f6 ("regmap: use debugfs even when no device")
> allows the usage of regmap debugfs even when there is no device
> associated, which causes several warnings like this:

> (NULL device *): Failed to create debugfs directory

> Do not print the warning in the case there is no associated device. 

>  	map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
>  	if (!map->debugfs) {
> -		dev_warn(map->dev, "Failed to create debugfs directory\n");
> +		if (map->dev)
> +			dev_warn(map->dev,
> +				 "Failed to create debugfs directory\n");

This then means that we will just randomly not create a debugfs for
anything except the first device that tries to do so with no device
which doesn't seem right.  We should try harder to create a name here,
for example we could try printing the pointer to the map.  Or keep a
counter and use dummy0 and so on.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] regmap: debugfs: Do not print warning when no device is associated
  2018-03-05 16:17 ` Mark Brown
@ 2018-03-05 18:29   ` Fabio Estevam
  0 siblings, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2018-03-05 18:29 UTC (permalink / raw)
  To: Mark Brown; +Cc: David Lechner, linux-kernel, Fabio Estevam

Hi Mark,

On Mon, Mar 5, 2018 at 1:17 PM, Mark Brown <broonie@kernel.org> wrote:

> This then means that we will just randomly not create a debugfs for
> anything except the first device that tries to do so with no device
> which doesn't seem right.  We should try harder to create a name here,
> for example we could try printing the pointer to the map.  Or keep a
> counter and use dummy0 and so on.

Tried your second suggestion of creating dummy0, dummy1, dummy2, etc
and it worked here.

Will send a v2 shortly.

Thanks

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

end of thread, other threads:[~2018-03-05 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-02 19:12 [PATCH] regmap: debugfs: Do not print warning when no device is associated Fabio Estevam
2018-03-05 16:17 ` Mark Brown
2018-03-05 18:29   ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).