diff mbox

[PATCH/RFC,v4,09/11] mediactl: Close only pipeline sub-devices

Message ID 1416586480-19982-10-git-send-email-j.anaszewski@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jacek Anaszewski Nov. 21, 2014, 4:14 p.m. UTC
The function media_device_new_by_entity_devname queries
media devices available in the system for containment
if given media entity. If a verification is negative
the media_device is released with media_device_unref.
In the previous approach media_device_unref was closing
all media entities it contained, which was undesirable
behavior as there might exist other initialized plugins
which had opened the same media_device and initialized
a pipeline. With this patch only the sub-devices that
belong to the pipeline of current media_device instance
will be closed.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 utils/media-ctl/libmediactl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c
index 003902b..9419fb4 100644
--- a/utils/media-ctl/libmediactl.c
+++ b/utils/media-ctl/libmediactl.c
@@ -917,13 +917,13 @@  void media_device_unref(struct media_device *media)
 	if (media->refcount > 0)
 		return;
 
+	media_close_pipeline_subdevs(media);
+
 	for (i = 0; i < media->entities_count; ++i) {
 		struct media_entity *entity = &media->entities[i];
 
 		free(entity->pads);
 		free(entity->links);
-		if (entity->sd->fd != -1)
-			close(entity->sd->fd);
 		free(entity->sd->v4l2_controls);
 		free(entity->sd);
 	}