mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] component: add optional cleanup function
@ 2018-10-09 21:30 Stefan Agner
  2018-10-09 21:30 ` [PATCH 2/2] drm/imx: make sure to cleanup DRM before unbinding components Stefan Agner
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Agner @ 2018-10-09 21:30 UTC (permalink / raw)
  To: p.zabel, airlied, gregkh
  Cc: rafael, linux, dri-devel, linux-kernel, Stefan Agner

Add optional cleanup function on master level. This allows the
master to call framework level cleanup functions in case binding
of any component failed before the previously successfully bound
components get unbound.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
Hi,

This is an attempt to fix the issue reported in:
"drm/imx: Crash in drm_mode_config_cleanup"

--
Stefan

 drivers/base/component.c  | 4 ++++
 include/linux/component.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index 8946dfee4768..5350d931a663 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -535,6 +535,10 @@ int component_bind_all(struct device *master_dev, void *data)
 				break;
 		}
 
+	/* Allow the master to call framework cleanup functions */
+	if (master->ops->cleanup)
+		master->ops->cleanup(master->dev);
+
 	if (ret != 0) {
 		for (; i--; )
 			if (!master->match->compare[i].duplicate) {
diff --git a/include/linux/component.h b/include/linux/component.h
index e71fbbbc74e2..800534b52165 100644
--- a/include/linux/component.h
+++ b/include/linux/component.h
@@ -24,6 +24,7 @@ struct master;
 struct component_master_ops {
 	int (*bind)(struct device *master);
 	void (*unbind)(struct device *master);
+	void (*cleanup)(struct device *master);
 };
 
 void component_master_del(struct device *,
-- 
2.19.1


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

end of thread, other threads:[~2018-10-10 11:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 21:30 [PATCH 1/2] component: add optional cleanup function Stefan Agner
2018-10-09 21:30 ` [PATCH 2/2] drm/imx: make sure to cleanup DRM before unbinding components Stefan Agner
2018-10-10 10:38   ` Russell King - ARM Linux
2018-10-10 11:02     ` Stefan Agner
2018-10-10 11:22       ` Russell King - ARM Linux

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®