mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regmap: add regmap_debugfs_exit as devres action
@ 2017-05-15  8:08 Stefan Agner
  2017-05-19 16:46 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Agner @ 2017-05-15  8:08 UTC (permalink / raw)
  To: broonie; +Cc: gregkh, linux-kernel, Stefan Agner

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

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

end of thread, other threads:[~2017-05-22 11:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15  8:08 [PATCH] regmap: add regmap_debugfs_exit as devres action Stefan Agner
2017-05-19 16:46 ` Mark Brown
2017-05-20  6:36   ` Stefan Agner
2017-05-22 11:33     ` Mark Brown

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®