#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);
// 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",
);
}
#endif /*CONFIG_OC_LINCAN_DETAILED_ERRORS*/
+#endif
}
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;
}
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));
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 *));
/* 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));
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;
}
}
}
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;
}
}