Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353945
b: refs/heads/master
c: 9682e28
h: refs/heads/master
i:
  353943: 0858e0b
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jan 7, 2013
1 parent 7acc568 commit a23b14d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 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: c098c21a9d32f1cd828f23e617cb55909c75e7e2
refs/heads/master: 9682e28c49f85d4a3c5d2cab401d03ae266f6dde
14 changes: 10 additions & 4 deletions trunk/drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,13 @@ static bool comedi_is_subdevice_in_error(struct comedi_subdevice *s)
return (runflags & SRF_ERROR) ? true : false;
}

static bool comedi_is_subdevice_idle(struct comedi_subdevice *s)
{
unsigned runflags = comedi_get_subdevice_runflags(s);

return (runflags & (SRF_ERROR | SRF_RUNNING)) ? false : true;
}

/*
This function restores a subdevice to an idle state.
*/
Expand Down Expand Up @@ -834,9 +841,8 @@ static int do_bufinfo_ioctl(struct comedi_device *dev,
bi.bytes_read = comedi_buf_read_alloc(async, bi.bytes_read);
comedi_buf_read_free(async, bi.bytes_read);

if (!(comedi_get_subdevice_runflags(s) & (SRF_ERROR |
SRF_RUNNING))
&& async->buf_write_count == async->buf_read_count) {
if (comedi_is_subdevice_idle(s) &&
async->buf_write_count == async->buf_read_count) {
do_become_nonbusy(dev, s);
}
}
Expand Down Expand Up @@ -2061,7 +2067,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
buf += n;
break; /* makes device work like a pipe */
}
if (!(comedi_get_subdevice_runflags(s) & (SRF_ERROR | SRF_RUNNING)) &&
if (comedi_is_subdevice_idle(s) &&
async->buf_read_count - async->buf_write_count == 0) {
do_become_nonbusy(dev, s);
}
Expand Down

0 comments on commit a23b14d

Please sign in to comment.