summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorIan Abbott2014-10-30 13:42:32 +0100
committerGreg Kroah-Hartman2014-11-04 01:28:47 +0100
commit75f6108fa91bb80e9f7e8ead81f0cedf171d00a2 (patch)
tree4670b72365d8de11aedda26151f6463c62ee0876 /drivers/staging/comedi/comedi_fops.c
parentstaging: comedi: check command direction in poll() file operation (diff)
downloadkernel-qcow2-linux-75f6108fa91bb80e9f7e8ead81f0cedf171d00a2.tar.gz
kernel-qcow2-linux-75f6108fa91bb80e9f7e8ead81f0cedf171d00a2.tar.xz
kernel-qcow2-linux-75f6108fa91bb80e9f7e8ead81f0cedf171d00a2.zip
staging: comedi: check actual data direction for COMEDI_BUFINFO ioctl
`do_bufinfo_ioctl()` handled the `COMEDI_BUFINFO` ioctl. It is supposed to update the read or write positions in the buffer depending on the direction of data transfer set up by the asynchronous command. Currently it checks the `SDF_CMD_READ` and `SDF_CMD_WRITE` subdevice flags. That's fine for most subdevices - the ones that only support one direction, but is incorrect for those subdevices that allow the command to be set up in either direction. Since we now set the `CMDF_WRITE` flag according to the data transfer direction of the current command running on the subdevice, check that flag instead. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedi_fops.c')
-rw-r--r--drivers/staging/comedi/comedi_fops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 63afd78441f1..704ae25c5710 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -991,7 +991,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev,
if (s->busy != file)
return -EACCES;
- if (bi.bytes_read && (s->subdev_flags & SDF_CMD_READ)) {
+ if (bi.bytes_read && !(async->cmd.flags & CMDF_WRITE)) {
bi.bytes_read = comedi_buf_read_alloc(s, bi.bytes_read);
comedi_buf_read_free(s, bi.bytes_read);
@@ -1001,7 +1001,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev,
}
}
- if (bi.bytes_written && (s->subdev_flags & SDF_CMD_WRITE)) {
+ if (bi.bytes_written && (async->cmd.flags & CMDF_WRITE)) {
bi.bytes_written =
comedi_buf_write_alloc(s, bi.bytes_written);
comedi_buf_write_free(s, bi.bytes_written);