]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
LinCAN can_usb1 code updated for latest kernels.
authorppisa <pisa@cmp.felk.cvut.cz>
Sat, 1 Nov 2008 13:11:23 +0000 (14:11 +0100)
committerppisa <pisa@cmp.felk.cvut.cz>
Sat, 1 Nov 2008 13:11:23 +0000 (14:11 +0100)
The freezer functions have been moved to linux/freezer.h headerfile.
Corrected name and body of the usbcan_report_error function.
The err() function does not compile correctly so use CANMSG
used in most of other files instead.

Signed-off-by: ppisa <pisa@cmp.felk.cvut.cz>
lincan/src/usbcan.c

index 42ece6f260314e729b7f1816d77500a9a92c8702..b7b595ffb4770acd8774e5e24f7c7ae0b47375e6 100644 (file)
 #include "../include/setup.h"
 #include "../include/usbcan.h"
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ #include <linux/freezer.h>
+#endif
+
 static int usbcan_probe(struct usb_interface *interface, const struct usb_device_id *id);
 static void usbcan_disconnect(struct usb_interface *interface);
 
@@ -173,12 +177,13 @@ int usbcan_register(struct hwspecops_t *hwspecops)
 
 // static int sja1000_report_error_limit_counter;
 
-static void sja1000_report_error(struct canchip_t *chip,
+static void usbcan_report_error(struct canchip_t *chip,
                                unsigned sr, unsigned ir, unsigned ecc)
 {
        /*TODO : Error reporting from device */
 
-/*     if(sja1000_report_error_limit_counter>=100)
+#if 0
+       if(sja1000_report_error_limit_counter>=100)
                return;
 
        CANMSG("Error: status register: 0x%x irq_register: 0x%02x error: 0x%02x\n",
@@ -211,6 +216,7 @@ static void sja1000_report_error(struct canchip_t *chip,
                      );
        }
 #endif /*CONFIG_OC_LINCAN_DETAILED_ERRORS*/
+#endif
 }
 
 
@@ -1212,7 +1218,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device
 
        iface_desc = interface->cur_altsetting;
        if (iface_desc->desc.bNumEndpoints % 2){
-               err("Endpoint count must be even");
+               CANMSG("Endpoint count must be even");
                goto noalloc;
        }
 
@@ -1220,7 +1226,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device
 
        usbdevs = (struct usbcan_devs *) can_checked_malloc(sizeof(struct usbcan_devs));
        if (!usbdevs) {
-               err("Out of memory");
+               CANMSG("Out of memory");
                goto error;
        }
        memset(usbdevs, 0, sizeof(struct usbcan_devs));
@@ -1229,7 +1235,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device
 
        usbdevs->devs = (struct usbcan_usb **) can_checked_malloc(usbcan_chip_count * sizeof(struct usbcan_usb *));
        if (!usbdevs->devs) {
-               err("Out of memory");
+               CANMSG("Out of memory");
                goto error;
        }
        memset(usbdevs->devs, 0, usbcan_chip_count * sizeof(struct usbcan_usb *));
@@ -1241,7 +1247,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device
                /* allocate memory for our device state and initialize it */
                usbdevs->devs[j] = (struct usbcan_usb *) can_checked_malloc(sizeof(struct usbcan_usb));
                if (!usbdevs->devs[j]) {
-                       err("Out of memory");
+                       CANMSG("Out of memory");
                        goto error;
                }
                memset(usbdevs->devs[j], 0, sizeof(struct usbcan_usb));
@@ -1275,7 +1281,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device
                                        dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
                                        dev->bulk_in_buffer = can_checked_malloc(buffer_size);
                                        if (!dev->bulk_in_buffer) {
-                                               err("Could not allocate bulk_in_buffer");
+                                               CANMSG("Could not allocate bulk_in_buffer");
                                                goto error;
                                        }
                                }
@@ -1291,7 +1297,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device
 
                }
                if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) {
-                       err("Could not find all bulk-in and bulk-out endpoints for chip %d",j);
+                       CANMSG("Could not find all bulk-in and bulk-out endpoints for chip %d",j);
                        goto error;
                }
        }