Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 92586
b: refs/heads/master
c: 009a905
h: refs/heads/master
v: v3
  • Loading branch information
Brandon Philips authored and Mauro Carvalho Chehab committed Apr 24, 2008
1 parent e96ca99 commit e5178d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b608f4323a0e0440d18fa13aea3db98351137487
refs/heads/master: 009a90597e177320e47154dd0817d201f52bcd46
37 changes: 15 additions & 22 deletions trunk/drivers/media/video/videobuf-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,32 +64,25 @@ void *videobuf_alloc(struct videobuf_queue *q)
return vb;
}

#define WAITON_CONDITION (vb->state != VIDEOBUF_ACTIVE &&\
vb->state != VIDEOBUF_QUEUED)
int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr)
{
int retval = 0;
DECLARE_WAITQUEUE(wait, current);

MAGIC_CHECK(vb->magic, MAGIC_BUFFER);
add_wait_queue(&vb->done, &wait);
while (vb->state == VIDEOBUF_ACTIVE || vb->state == VIDEOBUF_QUEUED) {
if (non_blocking) {
retval = -EAGAIN;
break;
}
set_current_state(intr ? TASK_INTERRUPTIBLE
: TASK_UNINTERRUPTIBLE);
if (vb->state == VIDEOBUF_ACTIVE ||
vb->state == VIDEOBUF_QUEUED)
schedule();
set_current_state(TASK_RUNNING);
if (intr && signal_pending(current)) {
dprintk(1, "buffer waiton: -EINTR\n");
retval = -EINTR;
break;
}

if (non_blocking) {
if (WAITON_CONDITION)
return 0;
else
return -EAGAIN;
}
remove_wait_queue(&vb->done, &wait);
return retval;

if (intr)
return wait_event_interruptible(vb->done, WAITON_CONDITION);
else
wait_event(vb->done, WAITON_CONDITION);

return 0;
}

int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb,
Expand Down

0 comments on commit e5178d3

Please sign in to comment.