summaryrefslogtreecommitdiff
path: root/include/media/media-entity.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-03-07 21:04:59 +0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 10:53:12 +0300
commit503c3d829eaf48837dd5bff5d97ad66369bb955a (patch)
tree9c14ed9561c5ffca07909e53d5ae0e52cdf5f99e /include/media/media-entity.h
parenta5ccc48a7c48610e7f92fa599406738d69195d51 (diff)
downloadlinux-503c3d829eaf48837dd5bff5d97ad66369bb955a.tar.xz
[media] media: Entity use count
Due to the wide differences between drivers regarding power management needs, the media controller does not implement power management. However, the media_entity structure includes a use_count field that media drivers can use to track the number of users of every entity for power management needs. The use_count field is owned by media drivers and must not be touched by entity drivers. Access to the field must be protected by the media device graph_mutex lock. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/media-entity.h')
-rw-r--r--include/media/media-entity.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 28f61f6ee549..a9b31d98e3c6 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -81,6 +81,12 @@ struct media_entity {
struct media_pad *pads; /* Pads array (num_pads elements) */
struct media_link *links; /* Links array (max_links elements)*/
+ /* Reference counts must never be negative, but are signed integers on
+ * purpose: a simple WARN_ON(<0) check can be used to detect reference
+ * count bugs that would make them negative.
+ */
+ int use_count; /* Use count for the entity. */
+
union {
/* Node specifications */
struct {
@@ -129,6 +135,9 @@ void media_entity_cleanup(struct media_entity *entity);
int media_entity_create_link(struct media_entity *source, u16 source_pad,
struct media_entity *sink, u16 sink_pad, u32 flags);
+struct media_entity *media_entity_get(struct media_entity *entity);
+void media_entity_put(struct media_entity *entity);
+
void media_entity_graph_walk_start(struct media_entity_graph *graph,
struct media_entity *entity);
struct media_entity *