report detailed CAN messages processing only if CAN_DEBUG is set.
authorppisa <pisa@cmp.felk.cvut.cz>
Tue, 11 Nov 2008 12:23:51 +0000 (13:23 +0100)
committerppisa <pisa@cmp.felk.cvut.cz>
Tue, 11 Nov 2008 12:23:51 +0000 (13:23 +0100)
lincan/src/usbcan.c

index b7b595f..f67f252 100644 (file)
@@ -525,7 +525,7 @@ int usbcan_chip_queue_status(struct canchip_t *chip)
        10000);
 
        if (retval==1){
-               CANMSG("Chip_queue_status: %d\n",buf[0]);
+               DEBUGMSG("Chip_queue_status: %d\n",buf[0]);
                if(buf[0]==1)
                        return 0;
                if(buf[0]==0)
@@ -696,10 +696,10 @@ int usbcan_config_irqs(struct canchip_t *chip, short irqs)
  */
 void usbcan_kthread_read_handler(struct usbcan_usb *dev, struct msgobj_t *obj){
        int i, j, len, retval;
-       CANMSG("USBCAN RX handler\n");
+       DEBUGMSG("USBCAN RX handler\n");
        for (i=0;i<USBCAN_TOT_RX_URBS;i++){
                if (test_and_clear_bit(USBCAN_MESSAGE_DATA_OK,&dev->rx[i].flags)){
-                       CANMSG("USBCAN Thread has received a message\n");
+                       DEBUGMSG("USBCAN Thread has received a message\n");
                        if ((dev->chip)&&(dev->chip->flags & CHIP_CONFIGURED)){
                                u8 *ptr;
                                struct usbcan_message *mess=&dev->rx[i];
@@ -723,7 +723,7 @@ void usbcan_kthread_read_handler(struct usbcan_usb *dev, struct msgobj_t *obj){
                                CANMSG("Destination chip not found\n");
                }
                if (!test_bit(USBCAN_MESSAGE_URB_PENDING,&dev->rx[i].flags)){
-                       CANMSG("Renewing RX urb\n");
+                       DEBUGMSG("Renewing RX urb\n");
                        retval = usb_submit_urb (dev->rx[i].u, GFP_KERNEL);
                        if (retval<0){
                                CANMSG("%d. URB error %d\n", i, retval);
@@ -747,11 +747,11 @@ void usbcan_kthread_read_handler(struct usbcan_usb *dev, struct msgobj_t *obj){
  */
 void usbcan_kthread_write_handler(struct usbcan_usb *dev, struct msgobj_t *obj){
        int i;
-       CANMSG("USBCAN TX handler\n");
+       DEBUGMSG("USBCAN TX handler\n");
        for (i=0;i<USBCAN_TOT_TX_URBS;i++){
                if (test_and_clear_bit(USBCAN_MESSAGE_DATA_OK,&dev->tx[i].flags)){
                        struct usbcan_message *mess=&dev->tx[i];
-                       CANMSG("USBCAN Message successfully sent\n");
+                       DEBUGMSG("USBCAN Message successfully sent\n");
 
                        if(mess->slot){
                                // Do local transmitted message distribution if enabled
@@ -796,7 +796,7 @@ void usbcan_kthread_write_request_handler(struct usbcan_usb *dev, struct msgobj_
                        u8 *ptr;
                        cmd=canque_test_outslot(obj->qends, &mess->qedge, &mess->slot);
                        if(cmd>=0){
-                               CANMSG("USBCAN Sending a message\n");
+                               DEBUGMSG("USBCAN Sending a message\n");
 
                                can_msgobj_set_fl(obj,TX_PENDING);
                                clear_bit(USBCAN_FREE_TX_URB,&dev->flags);
@@ -872,7 +872,7 @@ int usbcan_wakeup_tx(struct canchip_t *chip, struct msgobj_t *obj)
 {
        struct usbcan_usb *dev=(struct usbcan_usb *)chip->chip_data;
 
-       CANMSG("Trying to send message\n");
+       DEBUGMSG("Trying to send message\n");
        can_preempt_disable();
 
        can_msgobj_set_fl(obj,TX_PENDING);
@@ -1029,15 +1029,15 @@ static void usbcan_callback(struct urb *urb)
        switch (urb->status) {
        case 0:
                /* success */
-               CANMSG("%s > Message OK\n", __FUNCTION__);
+               DEBUGMSG("%s > Message OK\n", __FUNCTION__);
                set_bit(USBCAN_DATA_OK,&mess->dev->flags);
                set_bit(USBCAN_MESSAGE_DATA_OK,&mess->flags);
                if (test_bit(USBCAN_MESSAGE_TYPE_RX,&mess->flags)){
-                       CANMSG("%s > RX flag set\n", __FUNCTION__);
+                       DEBUGMSG("%s > RX flag set\n", __FUNCTION__);
                        set_bit(USBCAN_DATA_RX,&mess->dev->flags);
                }
                if (test_bit(USBCAN_MESSAGE_TYPE_TX,&mess->flags))
-                       CANMSG("%s > TX flag set\n", __FUNCTION__);
+                       DEBUGMSG("%s > TX flag set\n", __FUNCTION__);
                        set_bit(USBCAN_DATA_TX,&mess->dev->flags);
                clear_bit(USBCAN_MESSAGE_URB_PENDING,&mess->flags);
                if (test_bit(USBCAN_THREAD_RUNNING,&mess->dev->flags))
@@ -1166,7 +1166,7 @@ int usbcan_kthread(void *data)
 
                { /* Normal work to do */
                        if (test_and_clear_bit(USBCAN_DATA_OK,&dev->flags)){
-                               CANMSG("USBCAN Succesfull data transfer\n");
+                               DEBUGMSG("USBCAN Succesfull data transfer\n");
 
                                if (test_and_clear_bit(USBCAN_DATA_RX,&dev->flags)){
                                        usbcan_kthread_read_handler(dev, obj);