summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorH Hartley Sweeten2014-10-13 18:56:08 +0200
committerGreg Kroah-Hartman2014-10-29 08:47:11 +0100
commit781f933c151ee47e3cc1c8ef5491db23f1b61c9a (patch)
tree00503549f0cf61908ee7fe60038179c306333976 /drivers/staging/comedi/comedi_fops.c
parentstaging: comedi: comedidev.h: don't expose COMEDI_CB_* defines to userspace (diff)
downloadkernel-qcow2-linux-781f933c151ee47e3cc1c8ef5491db23f1b61c9a.tar.gz
kernel-qcow2-linux-781f933c151ee47e3cc1c8ef5491db23f1b61c9a.tar.xz
kernel-qcow2-linux-781f933c151ee47e3cc1c8ef5491db23f1b61c9a.zip
staging: comedi: comedidev.h: clarify async->event error/cancel detection
Introduce COMEDI_CB_ERROR_MASK and COMEDI_CB_CANCEL_MASK to clarify the async->events that indicate errors and cancel an async command. Use the new defines to tidy up and clarify the code. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> 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.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 224af2b2a685..2fb0f874f71f 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1555,9 +1555,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
comedi_buf_reset(s);
- async->cb_mask =
- COMEDI_CB_EOA | COMEDI_CB_BLOCK | COMEDI_CB_ERROR |
- COMEDI_CB_OVERFLOW;
+ async->cb_mask = COMEDI_CB_BLOCK | COMEDI_CB_CANCEL_MASK;
if (async->cmd.flags & CMDF_WAKE_EOS)
async->cb_mask |= COMEDI_CB_EOS;
@@ -2390,14 +2388,14 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
if (!comedi_is_subdevice_running(s))
return;
- if (s->
- async->events & (COMEDI_CB_EOA | COMEDI_CB_ERROR |
- COMEDI_CB_OVERFLOW)) {
+ if (s->async->events & COMEDI_CB_CANCEL_MASK)
runflags_mask |= SRF_RUNNING;
- }
- /* remember if an error event has occurred, so an error
- * can be returned the next time the user does a read() */
- if (s->async->events & (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)) {
+
+ /*
+ * Remember if an error event has occurred, so an error
+ * can be returned the next time the user does a read().
+ */
+ if (s->async->events & COMEDI_CB_ERROR_MASK) {
runflags_mask |= SRF_ERROR;
runflags |= SRF_ERROR;
}