LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] [media] v4l2-async: Pass the v4l2_async_subdev to the unbind callback
@ 2016-05-11  9:24 Alban Bedel
  0 siblings, 0 replies; only message in thread
From: Alban Bedel @ 2016-05-11  9:24 UTC (permalink / raw
  To: linux-media
  Cc: Mauro Carvalho Chehab, Sakari Ailus, Javier Martinez Canillas,
	Laurent Pinchart, linux-kernel, Alban Bedel

v4l2_async_cleanup() is always called before calling the unbind()
callback. However v4l2_async_cleanup() clears the asd member, so when
calling the unbind() callback the v4l2_async_subdev is always NULL. To
fix this save the asd before calling v4l2_async_cleanup().

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
 drivers/media/v4l2-core/v4l2-async.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index a4b224d..ceb28d4 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -220,6 +220,7 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
 	list_del(&notifier->list);
 
 	list_for_each_entry_safe(sd, tmp, &notifier->done, async_list) {
+		struct v4l2_async_subdev *asd = sd->asd;
 		struct device *d;
 
 		d = get_device(sd->dev);
@@ -230,7 +231,7 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
 		device_release_driver(d);
 
 		if (notifier->unbind)
-			notifier->unbind(notifier, sd, sd->asd);
+			notifier->unbind(notifier, sd, asd);
 
 		/*
 		 * Store device at the device cache, in order to call
@@ -313,6 +314,7 @@ EXPORT_SYMBOL(v4l2_async_register_subdev);
 void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
 {
 	struct v4l2_async_notifier *notifier = sd->notifier;
+	struct v4l2_async_subdev *asd = sd->asd;
 
 	if (!sd->asd) {
 		if (!list_empty(&sd->async_list))
@@ -327,7 +329,7 @@ void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
 	v4l2_async_cleanup(sd);
 
 	if (notifier->unbind)
-		notifier->unbind(notifier, sd, sd->asd);
+		notifier->unbind(notifier, sd, asd);
 
 	mutex_unlock(&list_lock);
 }
-- 
2.8.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-11  9:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-11  9:24 [PATCH v2] [media] v4l2-async: Pass the v4l2_async_subdev to the unbind callback Alban Bedel

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 read-only IMAP folder(s) and NNTP newsgroup(s).