mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: broonie@kernel.org
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	Stefan Agner <stefan@agner.ch>
Subject: [PATCH] regmap: add regmap_debugfs_exit as devres action
Date: Mon, 15 May 2017 01:08:27 -0700	[thread overview]
Message-ID: <20170515080827.22905-1-stefan@agner.ch> (raw)

Instead of manually cleanup regmap_debugfs_exit, use devres action
to do the cleanup. This also works for external users of
regmap_attach_dev.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
The cast is not that pretty, but I found it better than making
regmap_debugfs_exit type unsafe...

This fixes warnings when reloading certain drivers making use of
regmap_debugfs_exit:
  imx7d-pinctrl 30330000.iomuxc: Failed to create debugfs directory

--
Stefan

 drivers/base/regmap/regmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index b9a779a4a739..0e32e0e2f00a 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -528,6 +528,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,
 		return -ENOMEM;
 	}
 	*m = map;
+	devm_add_action(dev, (void (*)(void *))regmap_debugfs_exit, map);
 	devres_add(dev, m);
 
 	return 0;
@@ -1215,7 +1216,6 @@ void regmap_exit(struct regmap *map)
 	struct regmap_async *async;
 
 	regcache_exit(map);
-	regmap_debugfs_exit(map);
 	regmap_range_exit(map);
 	if (map->bus && map->bus->free_context)
 		map->bus->free_context(map->bus_context);
-- 
2.13.0

             reply	other threads:[~2017-05-15  8:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15  8:08 Stefan Agner [this message]
2017-05-19 16:46 ` Mark Brown
2017-05-20  6:36   ` Stefan Agner
2017-05-22 11:33     ` Mark Brown

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=20170515080827.22905-1-stefan@agner.ch \
    --to=stefan@agner.ch \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.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®