s = dev->read_subdev;
async = s->async;
if(s->busy){
- if((!s->subdev_flags&SDF_RUNNING) ||
- (async->buf_user_count < async->buf_int_count)){
+ if((async->buf_user_count < async->buf_int_count) ||
+ !(s->subdev_flags&SDF_RUNNING)){
mask |= POLLIN | POLLRDNORM;
}
}
s = dev->write_subdev;
async = s->async;
if(s->busy){
- if((!s->subdev_flags&SDF_RUNNING) ||
- (async->buf_user_count < async->buf_int_count)){
+ if(!(s->subdev_flags&SDF_RUNNING) ||
+ (async->buf_user_count < async->buf_int_count +
+ async->prealloc_bufsz)){
mask |= POLLOUT | POLLWRNORM;
}
}
void do_become_nonbusy(comedi_device *dev,comedi_subdevice *s)
{
comedi_async *async = s->async;
-#if 0
- printk("becoming non-busy\n");
-#endif
/* we do this because it's useful for the non-standard cases */
s->subdev_flags &= ~SDF_RUNNING;
//DPRINTK("comedi_event %x\n",mask);
+ if(mask&COMEDI_CB_EOA){
+ s->subdev_flags &= ~SDF_RUNNING;
+ }
+
+ /* remember if an error event has occured, so an error
+ * can be returned the next time the user does a read() */
+ if(mask & COMEDI_CB_ERROR){
+ s->runflags |= SRF_ERROR;
+ }
+
+ s->async->events = 0;
if(async->cb_mask&mask){
if(s->runflags&SRF_USER){
* common, I'm not going to worry about it. */
}
}
-
- if(mask&COMEDI_CB_EOA){
- s->subdev_flags &= ~SDF_RUNNING;
- }
-
- /* remember if an error event has occured, so an error
- * can be returned the next time the user does a read() */
- if(mask & COMEDI_CB_ERROR){
- s->runflags |= SRF_ERROR;
- }
-
- s->async->events = 0;
}
#if 0