X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/f22d7bfe6dc6b34be79f62fd3a71001cf9ce2ae2..8fdb6813a61bd9b0f5b98ee90d0ebbbcca82fad6:/lincan/src/finish.c diff --git a/lincan/src/finish.c b/lincan/src/finish.c index f10f309..bccf06b 100644 --- a/lincan/src/finish.c +++ b/lincan/src/finish.c @@ -14,7 +14,7 @@ #include "../include/finish.h" #include "../include/setup.h" - +extern int next_minor; /** * msgobj_done - destroys one CAN message object * @obj: pointer to CAN message object structure @@ -35,14 +35,17 @@ void msgobj_done(struct msgobj_t *obj) CANMSG("msgobj_done: not registered in the canchip_t\n"); obj->hostchip=NULL; } - + if((obj->minor>=0)) { - if(objects_p[obj->minor] == obj) + if(objects_p[obj->minor] == obj){ objects_p[obj->minor] = NULL; + if (--next_minor<0) + next_minor=0; + } else CANMSG("msgobj_done: not registered as minor\n"); } - + del_timer_sync(&obj->tx_timeout); if(obj->qends) { @@ -77,16 +80,16 @@ void canchip_done(struct canchip_t *chip) } can_chip_free_irq(chip); - + can_synchronize_irq(chip->chip_irq); - + for(i=0; imax_objects; i++){ if((obj=chip->msgobj[i])==NULL) continue; msgobj_done(obj); can_checked_free(obj); } - + can_checked_free(chip->chipspecops); chip->chipspecops=NULL; @@ -100,13 +103,13 @@ void candevice_done(struct candevice_t *candev) { int i; struct canchip_t *chip; - + for(i=0; inr_all_chips; i++){ if((chip=candev->chip[i])==NULL) continue; canchip_done(chip); can_checked_free(chip); - + } if(candev->flags & CANDEV_IO_RESERVED) { candev->hwspecops->release_io(candev); @@ -124,8 +127,8 @@ void canhardware_done(struct canhardware_t *canhw) { int i; struct candevice_t *candev; - - for(i=0; inr_boards; i++){ + + for(i=0; icandevice[i])==NULL) continue; candevice_done(candev);