]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/select.c
The use of chip->chip_data is unnecessary, chip->hostdevice points to corresponding...
[lincan.git] / lincan / src / select.c
index efdb212010e37e2372df0c27bb59df8a7ce59a7c..f9636f9df1178320dfc4071626b0da9e4d880e97 100644 (file)
@@ -4,15 +4,14 @@
  * Added by Pavel Pisa - OCERA team member
  * email:pisa@cmp.felk.cvut.cz
  * This software is released under the GPL-License.
- * Version lincan-0.2  9 Jul 2003
+ * Version lincan-0.3  17 Jun 2004
  */
 
-#include <linux/autoconf.h>
+#include "../include/can.h"
+#include "../include/can_sysdep.h"
+#include "../include/main.h"
 
-#include <linux/version.h>
 #include <linux/poll.h>
-
-#include "../include/main.h"
 #include "../include/select.h"
 
 unsigned int can_poll(struct file *file, poll_table *wait)
@@ -21,9 +20,7 @@ unsigned int can_poll(struct file *file, poll_table *wait)
        struct canque_ends_t *qends;
        struct msgobj_t *obj;
         unsigned int mask = 0;
-       unsigned long flags;
        struct canque_edge_t *edge;
-       struct list_head *entry;
        int full=0;
        int i;
 
@@ -46,13 +43,10 @@ unsigned int can_poll(struct file *file, poll_table *wait)
         if ((file->f_mode & FMODE_WRITE) && !(file->f_flags & O_SYNC)) {
                 poll_wait(file, &qends->endinfo.fileinfo.writeq, wait);
 
-               spin_lock_irqsave(&qends->ends_lock, flags);
-               list_for_each(entry,&qends->inlist){
-                       edge=list_entry(entry,struct canque_edge_t,inpeers);
+               canque_for_each_inedge(qends, edge) {
                        if(canque_fifo_test_fl(&edge->fifo,FULL))
                                full=1;
                }
-               spin_unlock_irqrestore(&qends->ends_lock, flags);
 
                if(!full)
                        mask |= POLLOUT | POLLWRNORM;
@@ -61,13 +55,10 @@ unsigned int can_poll(struct file *file, poll_table *wait)
         if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_SYNC)) {
                 poll_wait(file, &qends->endinfo.fileinfo.emptyq, wait);
 
-               spin_lock_irqsave(&qends->ends_lock, flags);
-               list_for_each(entry,&qends->inlist){
-                       edge=list_entry(entry,struct canque_edge_t,inpeers);
+               canque_for_each_inedge(qends, edge) {
                        if(!canque_fifo_test_fl(&edge->fifo,EMPTY))
                                full=1;
                }
-               spin_unlock_irqrestore(&qends->ends_lock, flags);
 
                if(!full)
                        mask |= POLLOUT | POLLWRNORM;