]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Ensure, that chip wakeup_tx function is not called for not fully setup CAN channel.
authorppisa <ppisa>
Wed, 8 Oct 2008 23:43:53 +0000 (23:43 +0000)
committerppisa <ppisa>
Wed, 8 Oct 2008 23:43:53 +0000 (23:43 +0000)
Problem found by Jan Kriz during USB<->CAN converter support development.

lincan/src/Makefile.omk
lincan/src/devcommon.c
lincan/src/finish.c

index b4249797eb2897cf273f1449ae1398768674a995..38a2ba238c8cebb39b5067b2c593c8d93f874fd0 100644 (file)
@@ -39,7 +39,7 @@ endif
 
 ifneq ($(filter hms30c7202_can ns_dev_can,$(lincan_cards_SELECTED)),)
 $(warning Not finished C_CAN support requested)
 
 ifneq ($(filter hms30c7202_can ns_dev_can,$(lincan_cards_SELECTED)),)
 $(warning Not finished C_CAN support requested)
-lincan_cards_SOURCES += c_can.c c_can_irq.c 
+lincan_cards_SOURCES += c_can.c c_can_irq.c
 endif
 
 ifneq ($(CONFIG_OC_LINCANRTL),y)
 endif
 
 ifneq ($(CONFIG_OC_LINCANRTL),y)
@@ -61,5 +61,5 @@ lincan_SOURCES = can_queue.c can_quekern.c main.c modparms.c \
                open.c close.c read.c write.c ioctl.c select.c fasync.c \
                proc.c ioctl_query.c ioctl_remote.c \
                $(lincan_cards_SOURCES) $(lincan_rtl_SOURCES)
                open.c close.c read.c write.c ioctl.c select.c fasync.c \
                proc.c ioctl_query.c ioctl_remote.c \
                $(lincan_cards_SOURCES) $(lincan_rtl_SOURCES)
-               
+
 endif #CONFIG_OC_LINCAN
 endif #CONFIG_OC_LINCAN
index 83412549ad89a94e9f3b76949a860f158aa48a52..bc4157defe2b9438d605eef8e2a9065821a724d5 100644 (file)
@@ -59,7 +59,10 @@ void canqueue_notify_chip(struct canque_ends_t *qends, struct canque_edge_t *qed
                case CANQUEUE_NOTIFY_PROC:
                    #ifndef CAN_WITH_RTL
                        /*wake_up(&qends->endinfo.chipinfo.daemonq);*/
                case CANQUEUE_NOTIFY_PROC:
                    #ifndef CAN_WITH_RTL
                        /*wake_up(&qends->endinfo.chipinfo.daemonq);*/
-                       chip->chipspecops->wakeup_tx(chip, obj);
+                       if(canque_fifo_test_fl(&qedge->fifo, READY)){
+                               if ((chip) && (chip->flags & CHIP_ATTACHED))
+                                       chip->chipspecops->wakeup_tx(chip, obj);
+                       }
                    #else /*CAN_WITH_RTL*/
                        can_msgobj_set_fl(obj,TX_REQUEST);
                        canqueue_wake_chip_worker(qends, chip, obj);
                    #else /*CAN_WITH_RTL*/
                        can_msgobj_set_fl(obj,TX_REQUEST);
                        canqueue_wake_chip_worker(qends, chip, obj);
index 532d868c4b8edf93a22775299aa842b625d20f1c..d25e936461637911b8dccbea231ed8b66db982d0 100644 (file)
@@ -66,8 +66,10 @@ void canchip_done(struct canchip_t *chip)
        int i;
        struct msgobj_t *obj;
 
        int i;
        struct msgobj_t *obj;
 
-       if(chip->flags & CHIP_ATTACHED)
+       if(chip->flags & CHIP_ATTACHED){
                chip->chipspecops->release_chip(chip);
                chip->chipspecops->release_chip(chip);
+               chip->flags &= ~CHIP_ATTACHED;
+       }
 
        if((chip->hostdevice) && (chip->chip_idx>=0)) {
                if(chip->hostdevice->chip[chip->chip_idx] == chip)
 
        if((chip->hostdevice) && (chip->chip_idx>=0)) {
                if(chip->hostdevice->chip[chip->chip_idx] == chip)