Revert poll conditions: if device is non-busy, set the poll flags so
authorDavid Schleef <ds@schleef.org>
Wed, 6 Feb 2002 21:48:05 +0000 (21:48 +0000)
committerDavid Schleef <ds@schleef.org>
Wed, 6 Feb 2002 21:48:05 +0000 (21:48 +0000)
the app can read the error.  This is how it used to be, and I'm not
sure why I changed (broke) it.

comedi/comedi_fops.c

index 3581c0e2a98f3525077cab8040e1abd615ed68d7..d72f6b12831a552c8774cb7d7ee6aac0817abd20 100644 (file)
@@ -1289,22 +1289,20 @@ static unsigned int comedi_poll_v22(struct file *file, poll_table * wait)
        if(dev->read_subdev && dev->read_subdev->async){
                s = dev->read_subdev;
                async = s->async;
-               if(s->busy){
-                       if((async->buf_user_count < async->buf_int_count) ||
-                          !(s->subdev_flags&SDF_RUNNING)){
-                               mask |= POLLIN | POLLRDNORM;
-                       }
+               if(!s->busy ||
+                  (async->buf_user_count < async->buf_int_count) ||
+                  !(s->subdev_flags&SDF_RUNNING)){
+                       mask |= POLLIN | POLLRDNORM;
                }
        }
        if(dev->write_subdev && dev->write_subdev->async){
                s = dev->write_subdev;
                async = s->async;
-               if(s->busy){
-                       if(!(s->subdev_flags&SDF_RUNNING) ||
-                          (async->buf_user_count < async->buf_int_count +
-                             async->prealloc_bufsz)){
-                               mask |= POLLOUT | POLLWRNORM;
-                       }
+               if(!s->busy ||
+                  !(s->subdev_flags&SDF_RUNNING) ||
+                  (async->buf_user_count < async->buf_int_count +
+                   async->prealloc_bufsz)){
+                       mask |= POLLOUT | POLLWRNORM;
                }
        }