]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Merge branch 'can-usb1' into spican1
authorIng. Jan Kriz <devel@jojen.net>
Mon, 18 Apr 2011 08:26:17 +0000 (10:26 +0200)
committerIng. Jan Kriz <devel@jojen.net>
Mon, 18 Apr 2011 08:26:17 +0000 (10:26 +0200)
Conflicts:
lincan/src/finish.c

lincan/include/constants.h
lincan/include/main.h
lincan/src/finish.c
lincan/src/usbcan.c

index 82383c265967650914e1e6a204a7aab35cfbd07c..1f0a45cc77d8382b1e7592a4cf4e4fd9f584faf8 100644 (file)
 #define CHIP_IRQ_VME     (1<<5)  /* interrupt is VME bus and requires VME bridge */
 #define CHIP_IRQ_CUSTOM  (1<<6)  /* custom interrupt provided by board or chip code */
 #define CHIP_IRQ_FAST    (1<<7)  /* interrupt handler only schedules postponed processing */
+#define CHIP_KEEP_DATA   (1<<8)  /* let the hotplug device free its chip_data structure itself */
 
 #define CHIP_MAX_IRQLOOP 1000
 
index 582d895e09efa924de6465353825c46aacaf5840..23accfb31ac56882fccd9f2eeaa6c83af06a14a1 100644 (file)
@@ -186,7 +186,7 @@ struct canchip_t {
        int chip_idx;   /* chip index in candevice_t.chip[] */
        int chip_irq;
        can_ioptr_t chip_base_addr;
-       unsigned int flags;
+       uint16_t flags;
        long clock; /* Chip clock in Hz */
        long baudrate;
 
index 9ba504ec0b83a5b7043c9cea75508c83e9ee56e4..6a69222d9700fd19ce9f867ba324086c86beb494 100644 (file)
@@ -118,7 +118,9 @@ void canchip_done(struct canchip_t *chip)
        }
 
        can_checked_free(chip->chipspecops);
-       can_checked_free(chip->chip_data);
+       
+       if(~chip->flags & CHIP_KEEP_DATA)
+               can_checked_free(chip->chip_data);
        chip->chip_data = NULL;
        chip->chipspecops=NULL;
 
index 19b1dc6ca3c5d0d9c2f352a786d94f493a75b815..3e1306a28d07996694065a0c671f94003e7c7adf 100644 (file)
@@ -1017,7 +1017,7 @@ int usbcan_init_chip_data(struct candevice_t *candev, int chipnr)
 
        usbcan_fill_chipspecops(chip);
 
-       candev->chip[chipnr]->flags|=CHIP_IRQ_CUSTOM;
+       candev->chip[chipnr]->flags|=CHIP_IRQ_CUSTOM|CHIP_KEEP_DATA;
        candev->chip[chipnr]->chip_base_addr=0;
        candev->chip[chipnr]->clock = 0;