3 linux/usb.h compatibility header
5 Copyright (C) 2003 Bernd Porr, Bernd.Porr@cn.stir.ac.uk
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef __COMPAT_LINUX_USB_H_
24 #define __COMPAT_LINUX_USB_H_
26 #include <linux/version.h>
27 #include <linux/time.h>
29 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
30 #include <linux/kernel.h>
32 #define USB_ALLOC_URB(x) usb_alloc_urb(x)
33 #define USB_SUBMIT_URB(x) usb_submit_urb(x)
34 #define URB_ISO_ASAP USB_ISO_ASAP
35 #define PROBE_ERR_RETURN(x) NULL
36 #define usb_get_dev(x) (x)
37 #define usb_put_dev(x)
38 #define interface_to_usbdev(intf) NULL
40 #define USB_ALLOC_URB(x) usb_alloc_urb(x,GFP_KERNEL)
41 #define USB_SUBMIT_URB(x) usb_submit_urb(x,GFP_ATOMIC)
42 #define PROBE_ERR_RETURN(x) (x)
45 #include <linux/usb.h>
47 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
48 static inline int USB_CONTROL_MSG(struct usb_device *dev, unsigned int pipe,
49 __u8 request, __u8 requesttype, __u16 value, __u16 index,
50 void *data, __u16 size, int millisec_timeout)
52 return usb_control_msg(dev, pipe, request, requesttype, value, index,
53 data, size, msecs_to_jiffies(millisec_timeout));
55 static inline int USB_BULK_MSG(struct usb_device *usb_dev, unsigned int pipe,
56 void *data, int len, int *actual_length, int millisec_timeout)
58 return usb_bulk_msg(usb_dev, pipe, data, len, actual_length,
59 msecs_to_jiffies(millisec_timeout));
62 #define USB_CONTROL_MSG usb_control_msg
63 #define USB_BULK_MSG usb_bulk_msg
67 * Determine whether we need the "owner" member of struct usb_driver and
68 * define COMEDI_HAVE_USB_DRIVER_OWNER if we need it.
70 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,19) \
71 && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
72 #define COMEDI_HAVE_USB_DRIVER_OWNER