Eliminated busy loop in the USB can sources and thread priority increased.
authorppisa <pisa@cmp.felk.cvut.cz>
Tue, 3 Feb 2009 03:06:55 +0000 (04:06 +0100)
committerppisa <pisa@cmp.felk.cvut.cz>
Tue, 3 Feb 2009 03:06:55 +0000 (04:06 +0100)
Signed-off-by: ppisa <pisa@cmp.felk.cvut.cz>
lincan/src/usbcan.c

index 01d2f90..429167c 100644 (file)
@@ -1213,6 +1213,12 @@ int usbcan_kthread(void *data)
        INIT_LIST_HEAD(&dev->tx_pend_list);
        INIT_LIST_HEAD(&dev->tx_ready_list);
 
+       if (1) {
+               struct sched_param param = { .sched_priority = 1 };
+               sched_setscheduler(current, SCHED_FIFO, &param);
+       }
+
+
        /* Prepare receive urbs  */
        for (i=0;i<USBCAN_TOT_RX_URBS;i++){
                struct usbcan_message *m;
@@ -1315,6 +1321,10 @@ int usbcan_kthread(void *data)
                        break;
                }
 
+               clear_bit(USBCAN_DATA_OK,&dev->flags);
+
+               mb();
+
                while(!list_empty(&dev->rx_ready_list)) {
                        struct usbcan_message *m;
                        m = list_first_entry(&dev->rx_ready_list, typeof(*m), list_node);