@@ -499,3 +499,38 @@ void media_request_object_complete(struct media_request_object *obj)
media_request_put(req);
}
EXPORT_SYMBOL_GPL(media_request_object_complete);
+
+void media_request_pin(struct media_request *req)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&req->lock, flags);
+ if (WARN_ON(req->state != MEDIA_REQUEST_STATE_QUEUED))
+ goto unlock;
+ req->num_incomplete_objects++;
+unlock:
+ spin_unlock_irqrestore(&req->lock, flags);
+}
+EXPORT_SYMBOL_GPL(media_request_pin);
+
+void media_request_unpin(struct media_request *req)
+{
+ unsigned long flags;
+ bool completed = false;
+
+ spin_lock_irqsave(&req->lock, flags);
+ if (WARN_ON(!req->num_incomplete_objects) ||
+ WARN_ON(req->state != MEDIA_REQUEST_STATE_QUEUED))
+ goto unlock;
+
+ if (!--req->num_incomplete_objects) {
+ req->state = MEDIA_REQUEST_STATE_COMPLETE;
+ wake_up_interruptible_all(&req->poll_wait);
+ completed = true;
+ }
+unlock:
+ spin_unlock_irqrestore(&req->lock, flags);
+ if (completed)
+ media_request_put(req);
+}
+EXPORT_SYMBOL_GPL(media_request_unpin);
@@ -189,6 +189,10 @@ static inline void media_request_get(struct media_request *req)
*/
void media_request_put(struct media_request *req);
+void media_request_pin(struct media_request *req);
+
+void media_request_unpin(struct media_request *req);
+
/**
* media_request_get_by_fd - Get a media request by fd
*
@@ -228,6 +232,14 @@ static inline void media_request_put(struct media_request *req)
{
}
+static inline void media_request_pin(struct media_request *req)
+{
+}
+
+static inline void media_request_unpin(struct media_request *req)
+{
+}
+
static inline struct media_request *
media_request_get_by_fd(struct media_device *mdev, int request_fd)
{