From 879982243998d6ebf7e7ac4e79b2cfc7371aeda2 Mon Sep 17 00:00:00 2001
From: Sakari Ailus <sakari.ailus@iki.fi>
Date: Fri, 7 Oct 2011 18:38:06 +0300
Subject: Add link to media_device from the media_entity

This makes it possible to obtain the media device an entity belongs to.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/mediactl.c | 1 +
 src/mediactl.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mediactl.c b/src/mediactl.c
index 82ede25..7b7b93a 100644
--- a/src/mediactl.c
+++ b/src/mediactl.c
@@ -372,6 +372,7 @@ static int media_enum_entities(struct media_device *media, int verbose)
 		memset(entity, 0, sizeof(*entity));
 		entity->fd = -1;
 		entity->info.id = id | MEDIA_ENT_ID_FLAG_NEXT;
+		entity->media = media;
 
 		ret = ioctl(media->fd, MEDIA_IOC_ENUM_ENTITIES, &entity->info);
 		if (ret < 0) {
diff --git a/src/mediactl.h b/src/mediactl.h
index 65ad890..fbd7813 100644
--- a/src/mediactl.h
+++ b/src/mediactl.h
@@ -38,6 +38,7 @@ struct media_pad {
 };
 
 struct media_entity {
+	struct media_device *media;
 	struct media_entity_desc info;
 	struct media_pad *pads;
 	struct media_link *links;
-- 
cgit v1.2.3