The patch number 7826 was added via Mauro Carvalho Chehab <[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: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
v4l2-i2c-drv*.h: fix warnings caused by I2C API change


The I2C changes at probe method did this:

In file included from /home/v4l/master/v4l/cx25840-core.c:42:
/home/v4l/master/v4l/../linux/include/media/v4l2-i2c-drv-legacy.h: In function 
'v4l2_i2c_drv_init':
/home/v4l/master/v4l/../linux/include/media/v4l2-i2c-drv-legacy.h:201: warning: 
assignment from incompatible pointer type

/home/v4l/master/v4l/../linux/include/media/v4l2-i2c-drv.h: In function 
'v4l2_i2c_drv_init':
/home/v4l/master/v4l/../linux/include/media/v4l2-i2c-drv.h:57: warning: 
assignment from incompatible pointer type

This patches creates a pseudo-function, at include/media/v4l2-i2c-drv-legacy.h
and on include/media/v4l2-i2c-drv.h, that makes the proper translation:

static int compat_legacy_probe(struct i2c_client *client)
{
        return v4l2_i2c_data.probe(client, NULL);
}

Hopefully, this will fix the issue of making the code backward compatible
without much changes.

Notice: The fix weren't tested on hardware. I'm currently out of town, without
hardware here.

Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 linux/include/media/v4l2-i2c-drv-legacy.h |   12 ++++++++++++
 linux/include/media/v4l2-i2c-drv.h        |   11 +++++++++++
 2 files changed, 23 insertions(+)

diff -r dd4685496fb7 -r 4c4fd6b8755c linux/include/media/v4l2-i2c-drv-legacy.h
--- a/linux/include/media/v4l2-i2c-drv-legacy.h Fri May 02 01:48:36 2008 -0300
+++ b/linux/include/media/v4l2-i2c-drv-legacy.h Fri May 02 07:51:27 2008 -0300
@@ -168,6 +168,14 @@ static struct i2c_driver v4l2_i2c_driver
 };
 #endif
 
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26)
+static int compat_legacy_probe(struct i2c_client *client)
+{
+       return v4l2_i2c_data.probe(client, NULL);
+}
+#endif
+
 static int __init v4l2_i2c_drv_init(void)
 {
        int err;
@@ -198,7 +206,11 @@ static int __init v4l2_i2c_drv_init(void
        v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
        v4l2_i2c_driver.id = v4l2_i2c_data.driverid;
        v4l2_i2c_driver.command = v4l2_i2c_data.command;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
        v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
+#else
+       v4l2_i2c_driver.probe = compat_legacy_probe;
+#endif
        v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
        err = i2c_add_driver(&v4l2_i2c_driver);
        if (err)
diff -r dd4685496fb7 -r 4c4fd6b8755c linux/include/media/v4l2-i2c-drv.h
--- a/linux/include/media/v4l2-i2c-drv.h        Fri May 02 01:48:36 2008 -0300
+++ b/linux/include/media/v4l2-i2c-drv.h        Fri May 02 07:51:27 2008 -0300
@@ -45,6 +45,13 @@ static struct v4l2_i2c_driver_data v4l2_
 static struct v4l2_i2c_driver_data v4l2_i2c_data;
 static struct i2c_driver v4l2_i2c_driver;
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26)
+static int compat_legacy_probe(struct i2c_client *client)
+{
+       return v4l2_i2c_data.probe(client, NULL);
+}
+#endif
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 
 /* Bus-based I2C implementation for kernels >= 2.6.22 */
@@ -54,7 +61,11 @@ static int __init v4l2_i2c_drv_init(void
        v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
        v4l2_i2c_driver.id = v4l2_i2c_data.driverid;
        v4l2_i2c_driver.command = v4l2_i2c_data.command;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
        v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
+#else
+       v4l2_i2c_driver.probe = compat_legacy_probe;
+#endif
        v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
        v4l2_i2c_driver.suspend = v4l2_i2c_data.suspend;
        v4l2_i2c_driver.resume = v4l2_i2c_data.resume;


---

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

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to