2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-24 21:24:00 +08:00

staging: comedi: COMEDI_BUFINFO: become non-busy even if bytes_read is 0

The `COMEDI_BUFINFO` ioctl is used to advance the current position in
the buffer by a specified amount (which can be 0) and get the new
position.  On input, the `bytes_read` member of `struct comedi_bufinfo`
specified the amount to advance the "read" position for an asynchronous
command in the "read" direction.  If the command has already stopped
normally, and the "read" position has been advanced to the end of all
available data, the command is terminated by calling
`do_become_nonbusy()`.  (That is not currently done if the command
stopped with an error.)  Currently, the command is only terminated if
the user is trying to advance the "read" position by a non-zero amount.
Change it to allow the command to be terminated even if the user is not
trying to advance the "read" position.  This is justifiable, as the only
time a command stops without error is when it has been set up to read a
finite amount of data.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ian Abbott 2016-02-19 16:13:55 +00:00 committed by Greg Kroah-Hartman
parent 57c563bf78
commit f3aa8c0bec

View File

@ -1131,11 +1131,10 @@ static int do_bufinfo_ioctl(struct comedi_device *dev,
if (bi.bytes_read) { if (bi.bytes_read) {
comedi_buf_read_alloc(s, bi.bytes_read); comedi_buf_read_alloc(s, bi.bytes_read);
bi.bytes_read = comedi_buf_read_free(s, bi.bytes_read); bi.bytes_read = comedi_buf_read_free(s, bi.bytes_read);
if (comedi_is_subdevice_idle(s) &&
comedi_buf_read_n_available(s) == 0)
become_nonbusy = true;
} }
if (comedi_is_subdevice_idle(s) &&
comedi_buf_read_n_available(s) == 0)
become_nonbusy = true;
bi.bytes_written = 0; bi.bytes_written = 0;
} else { } else {
/* command was set up in "write" direction */ /* command was set up in "write" direction */