]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/finish.c
Structured comments updated.
[lincan.git] / lincan / src / finish.c
index a5cd8d176413cf85b38595d07211a7a66cdc06e1..9016ae8b9b6c6cdc3ad9a9961446b7bc4766a40f 100644 (file)
@@ -6,11 +6,16 @@
 #include "../include/setup.h"
 
 
-
+/**
+ * msgobj_done - destroys one CAN message object
+ * @obj: pointer to CAN message object structure
+ */
 void msgobj_done(struct msgobj_t *obj)
 {
+       int delayed=0;
        if(obj->qends) {
-               if(canqueue_ends_done_chip(obj->qends) < 0)
+               delayed=canqueue_ends_done_chip(obj->qends);
+               if(delayed < 0)
                        CANMSG("msgobj_done: problem with chip queue ends\n");
        }
 
@@ -32,12 +37,20 @@ void msgobj_done(struct msgobj_t *obj)
        del_timer_sync(&obj->tx_timeout);
 
        if(obj->qends) {
-               can_checked_free(obj->qends);
+               /*delayed free could be required there in the future,
+                 actual use patter cannot generate such situation*/
+               if(!delayed) {
+                       can_checked_free(obj->qends);
+               }
        }
        obj->qends=NULL;
 }
 
 
+/**
+ * canchip_done - destroys one CAN chip representation
+ * @chip: pointer to CAN chip structure
+ */
 void canchip_done(struct chip_t *chip)
 {
 
@@ -51,10 +64,7 @@ void canchip_done(struct chip_t *chip)
                        CANMSG("canchip_done: not registered in hostdevice\n");
        }
 
-       if((chip->flags & CHIP_IRQ_SETUP) && (chip->chip_irq>=0)) {
-               free_irq(chip->chip_irq, chip);
-               chip->flags &= ~CHIP_IRQ_SETUP;
-       }
+       can_chip_free_irq(chip);
                
        can_synchronize_irq(chip->chip_irq);
        
@@ -70,6 +80,10 @@ void canchip_done(struct chip_t *chip)
 
 }
 
+/**
+ * candevice_done - destroys representation of one CAN device/board
+ * @candev: pointer to CAN device/board structure
+ */
 void candevice_done(struct candevice_t *candev)
 {
        int i;
@@ -90,6 +104,10 @@ void candevice_done(struct candevice_t *candev)
        candev->hwspecops=NULL;
 }
 
+/**
+ * candevice_done - destroys representation of all CAN devices/boards
+ * @canhw: pointer to the root of all CAN hardware representation
+ */
 void canhardware_done(struct canhardware_t *canhw)
 {
        int i;