summaryrefslogtreecommitdiff
path: root/linux/include/media/v4l2-i2c-drv.h
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-05-02 07:51:27 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-05-02 07:51:27 -0300
commit6fa830d31ee7880f2ca969e559c57fc69b5ebfd1 (patch)
tree00b2ea09ab6fd93eff027df0065d019acf250cbb /linux/include/media/v4l2-i2c-drv.h
parent7004e666bc83e2d18605d5342afcfea363dc0532 (diff)
downloadmediapointer-dvb-s2-6fa830d31ee7880f2ca969e559c57fc69b5ebfd1.tar.gz
mediapointer-dvb-s2-6fa830d31ee7880f2ca969e559c57fc69b5ebfd1.tar.bz2
v4l2-i2c-drv*.h: fix warnings caused by I2C API change
From: Mauro Carvalho Chehab <mchehab@infradead.org> 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 <mchehab@infradead.org>
Diffstat (limited to 'linux/include/media/v4l2-i2c-drv.h')
-rw-r--r--linux/include/media/v4l2-i2c-drv.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/linux/include/media/v4l2-i2c-drv.h b/linux/include/media/v4l2-i2c-drv.h
index ed1a752bd..5b4959620 100644
--- a/linux/include/media/v4l2-i2c-drv.h
+++ b/linux/include/media/v4l2-i2c-drv.h
@@ -45,6 +45,13 @@ struct v4l2_i2c_driver_data {
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;