]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/can_queue.c
LinCAN can be compiled in mode with RT-Linux chip worker threads now.
[lincan.git] / lincan / src / can_queue.c
index c0f1a6dc7e0a8926c5670dd6103115f5c99e7fe2..96c37a4acb9a3d44581f2269908ed20b8a56dc9f 100644 (file)
@@ -21,9 +21,10 @@ extern int processlocal;
 atomic_t edge_num_cnt;
 
 //#define CAN_DEBUG
+#undef CAN_DEBUG
 
 #ifdef CAN_DEBUG
-       #define DEBUGQUE(fmt,args...) printk(KERN_ERR "can_queue (debug): " fmt,\
+       #define DEBUGQUE(fmt,args...) can_printk(KERN_ERR "can_queue (debug): " fmt,\
        ##args)
 
 #else
@@ -65,21 +66,17 @@ int canque_fifo_flush_slots(struct canque_fifo_t *fifo)
 
 
 /**
- * canque_fifo_init_slots - initialize one CAN FIFO
+ * canque_fifo_init_slots - initializes slot chain of one CAN FIFO
  * @fifo: pointer to the FIFO structure
- * @slotsnr: number of requested slots
  *
  * Return Value: The negative value indicates, that there is no memory
  *     to allocate space for the requested number of the slots.
  */
-int canque_fifo_init_slots(struct canque_fifo_t *fifo, int slotsnr)
+int canque_fifo_init_slots(struct canque_fifo_t *fifo)
 {
-       int size;
        struct canque_slot_t *slot;
-       if(!slotsnr) slotsnr=MAX_BUF_LENGTH;
-       size=sizeof(struct canque_slot_t)*slotsnr;
-       fifo->entry=kmalloc(size,GFP_KERNEL);
-       if(!fifo->entry) return -1;
+       int slotsnr=fifo->slotsnr;
+       if(!fifo->entry || !slotsnr) return -1;
        slot=fifo->entry;
        fifo->flist=slot;
        while(--slotsnr){
@@ -93,18 +90,6 @@ int canque_fifo_init_slots(struct canque_fifo_t *fifo, int slotsnr)
        return 1;
 }
 
-/**
- * canque_fifo_done - frees slots allocated for CAN FIFO
- * @fifo: pointer to the FIFO structure
- */
-int canque_fifo_done(struct canque_fifo_t *fifo)
-{
-       if(fifo->entry)
-               kfree(fifo->entry);
-       fifo->entry=NULL;
-       return 1;
-}
-
 /* atomic_dec_and_test(&qedge->edge_used);
  void atomic_inc(&qedge->edge_used);
  list_add_tail(struct list_head *new, struct list_head *head)