@@ -38,6 +38,14 @@
#ifdef CONFIG_MEDIA_CONTROLLER
+static char *__request_state[] = {
+ "IDLE",
+ "QUEUED",
+};
+
+#define request_state(i) \
+ ((i) < ARRAY_SIZE(__request_state) ? __request_state[i] : "UNKNOWN")
+
struct media_device_fh {
struct media_devnode_fh fh;
struct list_head requests;
@@ -140,6 +148,7 @@ static int media_device_request_alloc(struct media_device *mdev,
req->mdev = mdev;
req->id = id;
req->filp = filp;
+ req->state = MEDIA_DEVICE_REQUEST_STATE_IDLE;
kref_init(&req->kref);
spin_lock_irqsave(&mdev->req_lock, flags);
@@ -265,6 +265,11 @@
struct device;
struct media_device;
+enum media_device_request_state {
+ MEDIA_DEVICE_REQUEST_STATE_IDLE,
+ MEDIA_DEVICE_REQUEST_STATE_QUEUED,
+};
+
/**
* struct media_device_request - Media device request
* @id: Request ID
@@ -272,6 +277,8 @@ struct media_device;
* @kref: Reference count
* @list: List entry in the media device requests list
* @fh_list: List entry in the media file handle requests list
+ * @state: The state of the request, MEDIA_DEVICE_REQUEST_STATE_*,
+ * access to state serialised by mdev->req_lock
*/
struct media_device_request {
u32 id;
@@ -280,6 +287,7 @@ struct media_device_request {
struct kref kref;
struct list_head list;
struct list_head fh_list;
+ enum media_device_request_state state;
};
/**
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- drivers/media/media-device.c | 9 +++++++++ include/media/media-device.h | 8 ++++++++ 2 files changed, 17 insertions(+)