]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/write.c
Header-files cleanup and CAN queue edges and ends locking reimplemented.
[lincan.git] / lincan / src / write.c
index 2f32b2ead2fb30ba9e7fdb6530ff92f3f47763c4..1869c9750940d8ad13b329315bf444d819e5c80c 100644 (file)
@@ -7,16 +7,8 @@
  * Version lincan-0.2  9 Jul 2003
  */
 
-#include <linux/autoconf.h>
-
-#define __NO_VERSION__
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/delay.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-
+#include "../include/can.h"
+#include "../include/can_sysdep.h"
 #include "../include/main.h"
 
 ssize_t can_write(struct file *file, const char *buffer, size_t length, loff_t *offset)
@@ -70,11 +62,12 @@ ssize_t can_write(struct file *file, const char *buffer, size_t length, loff_t *
        if ((ret=canque_get_inslot4id(qends, &qedge, &slot, 
                        0, msg_buff.id, 0))<0){
                DEBUGMSG("Buffer is full\n");
-               if (file->f_flags & O_NONBLOCK)
-                       return -EAGAIN;
                if(ret < -1)
                        return -EIO;
 
+               if (file->f_flags & O_NONBLOCK)
+                       return -EAGAIN;
+
                ret=canque_get_inslot4id_wait_kern(qends, &qedge, &slot, 
                                                0, msg_buff.id, 0);
                if(ret<0) {