1 #include "../include/can.h"
2 #include "../include/can_sysdep.h"
3 #include "../include/main.h"
4 #include "../include/devcommon.h"
5 #include "../include/finish.h"
6 #include "../include/setup.h"
10 void msgobj_done(struct msgobj_t *obj)
13 if(canqueue_ends_done_chip(obj->qends) < 0)
14 CANMSG("msgobj_done: problem with chip queue ends\n");
17 if((obj->hostchip) && (obj->object>0)) {
18 if(obj->hostchip->msgobj[obj->object-1] == obj)
19 obj->hostchip->msgobj[obj->object-1]=NULL;
21 CANMSG("msgobj_done: not registered in the chip_t\n");
26 if(objects_p[obj->minor] == obj)
27 objects_p[obj->minor] = NULL;
29 CANMSG("msgobj_done: not registered as minor\n");
32 del_timer_sync(&obj->tx_timeout);
35 can_checked_free(obj->qends);
41 void canchip_done(struct chip_t *chip)
47 if((chip->hostdevice) && (chip->chip_idx>=0)) {
48 if(chip->hostdevice->chip[chip->chip_idx] == chip)
49 chip->hostdevice->chip[chip->chip_idx] = NULL;
51 CANMSG("canchip_done: not registered in hostdevice\n");
54 if((chip->flags & CHIP_IRQ_SETUP) && (chip->chip_irq>=0)) {
55 free_irq(chip->chip_irq, chip);
56 chip->flags &= ~CHIP_IRQ_SETUP;
59 can_synchronize_irq(chip->chip_irq);
61 for(i=0; i<chip->max_objects; i++){
62 if((obj=chip->msgobj[i])==NULL)
65 can_checked_free(obj);
68 can_checked_free(chip->chipspecops);
69 chip->chipspecops=NULL;
73 void candevice_done(struct candevice_t *candev)
78 for(i=0; i<candev->nr_all_chips; i++){
79 if((chip=candev->chip[i])==NULL)
82 can_checked_free(chip);
85 if(candev->flags & CANDEV_IO_RESERVED) {
86 candev->hwspecops->release_io(candev);
87 candev->flags &= ~CANDEV_IO_RESERVED;
89 can_checked_free(candev->hwspecops);
90 candev->hwspecops=NULL;
93 void canhardware_done(struct canhardware_t *canhw)
96 struct candevice_t *candev;
98 for(i=0; i<canhw->nr_boards; i++){
99 if((candev=canhw->candevice[i])==NULL)
101 candevice_done(candev);
102 can_checked_free(candev);