From 595bdd2676019668aaa0adf4c84ef9fbd2cb7c9e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 5 Dec 2007 17:02:01 +0000 Subject: [PATCH] For read and write, check if command still running in non-blocking mode as well. --- comedi/comedi_fops.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index e686a178..eb0347b3 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -1459,10 +1459,6 @@ static ssize_t comedi_write(struct file *file, const char *buf, size_t nbytes, n = m; if (n == 0) { - if (file->f_flags & O_NONBLOCK) { - retval = -EAGAIN; - break; - } if (!(comedi_get_subdevice_runflags(s) & SRF_RUNNING)) { if (comedi_get_subdevice_runflags(s) & SRF_ERROR) { @@ -1473,6 +1469,10 @@ static ssize_t comedi_write(struct file *file, const char *buf, size_t nbytes, do_become_nonbusy(dev, s); break; } + if (file->f_flags & O_NONBLOCK) { + retval = -EAGAIN; + break; + } if (signal_pending(current)) { retval = -ERESTARTSYS; break; @@ -1545,10 +1545,6 @@ static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes, n = m; if (n == 0) { - if (file->f_flags & O_NONBLOCK) { - retval = -EAGAIN; - break; - } if (!(comedi_get_subdevice_runflags(s) & SRF_RUNNING)) { do_become_nonbusy(dev, s); if (comedi_get_subdevice_runflags(s) & @@ -1559,6 +1555,10 @@ static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes, } break; } + if (file->f_flags & O_NONBLOCK) { + retval = -EAGAIN; + break; + } if (signal_pending(current)) { retval = -ERESTARTSYS; break; -- 2.26.2