diff options
author | Laurent Pinchart <laurent.pinchart@skynet.be> | 2008-11-11 17:43:40 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@skynet.be> | 2008-11-11 17:43:40 +0100 |
commit | 2c2545da4d6f060cd6b64c71469a61cd455ba6d9 (patch) | |
tree | 90ce729a1cc83735c7c8a9e425c9f4601e054806 /v4l/compat.h | |
parent | 6d66e543c6fd8adfc1495538a68b849999a8cc90 (diff) | |
download | mediapointer-dvb-s2-2c2545da4d6f060cd6b64c71469a61cd455ba6d9.tar.gz mediapointer-dvb-s2-2c2545da4d6f060cd6b64c71469a61cd455ba6d9.tar.bz2 |
uvcvideo: Enable compilation on kernels older than 2.6.22
From: Laurent Pinchart <laurent.pinchart@skynet.be>
The uvcvideo driver makes use of the usb_endpoint_* functions as well as
the list_first_entry and uninitialized_var macros. Add them to v4l/compat.h
and update the driver with kernel version-based conditional compilation
sections.
Priority: normal
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Diffstat (limited to 'v4l/compat.h')
-rw-r--r-- | v4l/compat.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/v4l/compat.h b/v4l/compat.h index 3c0c2e345..d041cbe38 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -258,4 +258,69 @@ static inline int list_is_singular(const struct list_head *head) #define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102 #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) +#ifdef __LINUX_USB_H +/* + * usb_endpoint_* functions + * + * Included in Linux 2.6.19 + * Backported to 2.6.18 in Red Hat Enterprise Linux 5.2 + */ + +#ifdef RHEL_RELEASE_CODE +#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 2) +#define RHEL_HAS_USB_ENDPOINT +#endif +#endif + +#ifndef RHEL_HAS_USB_ENDPOINT +static inline int +usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) +{ + return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN; +} + +static inline int +usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) +{ + return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_INT; +} + +static inline int +usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd) +{ + return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_ISOC; +} + +static inline int +usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) +{ + return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_BULK; +} + +static inline int +usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) +{ + return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd); +} +#endif /* RHEL_HAS_USB_ENDPOINT */ +#endif /* __LINUX_USB_H */ +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) +/* + * Linked list API + */ +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +/* + * uninitialized_var() macro + */ +#define uninitialized_var(x) x +#endif + #endif |