X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/cc1811f284f00d214e198cb20b466d261201385b..b34a548a5dfd2f0b068fd835a4cd51680d851068:/lincan/src/can_queue.c diff --git a/lincan/src/can_queue.c b/lincan/src/can_queue.c index c0f1a6d..96c37a4 100644 --- a/lincan/src/can_queue.c +++ b/lincan/src/can_queue.c @@ -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)