summaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-device.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 3b723283da26..bd102cf509ac 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -60,8 +60,19 @@ struct v4l2_device {
struct v4l2_prio_state prio;
/* BKL replacement mutex. Temporary solution only. */
struct mutex ioctl_lock;
+ /* Keep track of the references to this struct. */
+ struct kref ref;
+ /* Release function that is called when the ref count goes to 0. */
+ void (*release)(struct v4l2_device *v4l2_dev);
};
+static inline void v4l2_device_get(struct v4l2_device *v4l2_dev)
+{
+ kref_get(&v4l2_dev->ref);
+}
+
+int v4l2_device_put(struct v4l2_device *v4l2_dev);
+
/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
dev may be NULL in rare cases (ISA devices). In that case you
must fill in the v4l2_dev->name field before calling this function. */
OpenPOWER on IntegriCloud