The patch number 10145 was added via Hans Verkuil <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [email protected]

------

From: Hans Verkuil  <[email protected]>
v4l: fix compile errors for older kernels


Priority: normal

Signed-off-by: Hans Verkuil <[email protected]>


---

 linux/drivers/media/dvb/frontends/af9013.c |    1 
 linux/drivers/media/video/mt9t031.c        |    8 ++
 linux/drivers/media/video/tw9910.c         |    8 ++
 v4l/compat.h                               |   61 ++++++++++++++++++++-
 4 files changed, 76 insertions(+), 2 deletions(-)

diff -r 1189c350a7e8 -r ba3c5b502a17 linux/drivers/media/dvb/frontends/af9013.c
--- a/linux/drivers/media/dvb/frontends/af9013.c        Tue Dec 30 10:17:59 
2008 -0200
+++ b/linux/drivers/media/dvb/frontends/af9013.c        Tue Dec 30 21:58:17 
2008 +0100
@@ -33,6 +33,7 @@
 #include "dvb_frontend.h"
 #include "af9013_priv.h"
 #include "af9013.h"
+#include "compat.h"
 
 int af9013_debug;
 
diff -r 1189c350a7e8 -r ba3c5b502a17 linux/drivers/media/video/mt9t031.c
--- a/linux/drivers/media/video/mt9t031.c       Tue Dec 30 10:17:59 2008 -0200
+++ b/linux/drivers/media/video/mt9t031.c       Tue Dec 30 21:58:17 2008 +0100
@@ -632,8 +632,12 @@ static void mt9t031_video_remove(struct 
        soc_camera_video_stop(icd);
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
+static int mt9t031_probe(struct i2c_client *client)
+#else
 static int mt9t031_probe(struct i2c_client *client,
                         const struct i2c_device_id *did)
+#endif
 {
        struct mt9t031 *mt9t031;
        struct soc_camera_device *icd;
@@ -703,19 +707,23 @@ static int mt9t031_remove(struct i2c_cli
        return 0;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
 static const struct i2c_device_id mt9t031_id[] = {
        { "mt9t031", 0 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, mt9t031_id);
 
+#endif
 static struct i2c_driver mt9t031_i2c_driver = {
        .driver = {
                .name = "mt9t031",
        },
        .probe          = mt9t031_probe,
        .remove         = mt9t031_remove,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
        .id_table       = mt9t031_id,
+#endif
 };
 
 static int __init mt9t031_mod_init(void)
diff -r 1189c350a7e8 -r ba3c5b502a17 linux/drivers/media/video/tw9910.c
--- a/linux/drivers/media/video/tw9910.c        Tue Dec 30 10:17:59 2008 -0200
+++ b/linux/drivers/media/video/tw9910.c        Tue Dec 30 21:58:17 2008 +0100
@@ -837,8 +837,12 @@ static struct soc_camera_ops tw9910_ops 
  * i2c_driver function
  */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
+static int tw9910_probe(struct i2c_client *client)
+#else
 static int tw9910_probe(struct i2c_client *client,
                        const struct i2c_device_id *did)
+#endif
 
 {
        struct tw9910_priv             *priv;
@@ -915,19 +919,23 @@ static int tw9910_remove(struct i2c_clie
        return 0;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
 static const struct i2c_device_id tw9910_id[] = {
        { "tw9910", 0 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, tw9910_id);
 
+#endif
 static struct i2c_driver tw9910_i2c_driver = {
        .driver = {
                .name = "tw9910",
        },
        .probe    = tw9910_probe,
        .remove   = tw9910_remove,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
        .id_table = tw9910_id,
+#endif
 };
 
 /*
diff -r 1189c350a7e8 -r ba3c5b502a17 v4l/compat.h
--- a/v4l/compat.h      Tue Dec 30 10:17:59 2008 -0200
+++ b/v4l/compat.h      Tue Dec 30 21:58:17 2008 +0100
@@ -280,8 +280,8 @@ static inline int dummy_algo_control(str
 #define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC     0x4102
 #endif
 
+#ifdef __LINUX_USB_H
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
-#ifdef __LINUX_USB_H
 /*
  * usb_endpoint_* functions
  *
@@ -328,9 +328,66 @@ usb_endpoint_is_int_in(const struct usb_
 {
        return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
 }
+
+static inline int usb_endpoint_dir_out(
+                               const struct usb_endpoint_descriptor *epd)
+{
+       return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
+}
+
+static inline int usb_endpoint_is_bulk_in(
+                               const struct usb_endpoint_descriptor *epd)
+{
+       return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
+}
+
+static inline int usb_endpoint_is_bulk_out(
+                               const struct usb_endpoint_descriptor *epd)
+{
+       return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
+}
+
+static inline int usb_endpoint_is_int_out(
+                               const struct usb_endpoint_descriptor *epd)
+{
+       return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
+}
+
+static inline int usb_endpoint_is_isoc_in(
+                               const struct usb_endpoint_descriptor *epd)
+{
+       return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
+}
+
+static inline int usb_endpoint_is_isoc_out(
+                               const struct usb_endpoint_descriptor *epd)
+{
+       return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
+}
 #endif /* RHEL_HAS_USB_ENDPOINT */
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
+static inline int usb_endpoint_xfer_control(
+                               const struct usb_endpoint_descriptor *epd)
+{
+       return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+               USB_ENDPOINT_XFER_CONTROL);
+}
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
+static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
+{
+       return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+}
+
+static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
+{
+       return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+}
+#endif
 #endif /* __LINUX_USB_H */
-#endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
 /*


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/ba3c5b502a17b87fb006d6cb9131f28300d6e4b2

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to