summaryrefslogtreecommitdiff
path: root/linux/include
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-03-30 01:04:44 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2009-03-30 01:04:44 +0200
commit1784ea5527ed756f946958f45f74d1f15797c366 (patch)
tree8126fc8bf73357835aca910bb3d95be555e7af7e /linux/include
parent221b2e5d87ca670a9b764323c59445f1b6e3df27 (diff)
downloadmediapointer-dvb-s2-1784ea5527ed756f946958f45f74d1f15797c366.tar.gz
mediapointer-dvb-s2-1784ea5527ed756f946958f45f74d1f15797c366.tar.bz2
v4l2: use old-style i2c API for kernels < 2.6.26 instead of < 2.6.22
From: Hans Verkuil <hverkuil@xs4all.nl> Originally the intention was to switch to the new style i2c API starting with the introduction of the API in 2.6.22. However, the i2c_new_probed_device() function has a lethal bug that wasn't fixed until 2.6.25. Or more accurately, it was only fixed in the stable series of 2.6.25 and 2.6.26. Given the fact that the new i2c API also changed starting with 2.6.26 (the addition of i2c_device_id), it is easiest to switch APIs starting with 2.6.26. This patch updates all the legacy code accordingly. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/include')
-rw-r--r--linux/include/media/v4l2-common.h2
-rw-r--r--linux/include/media/v4l2-i2c-drv.h21
2 files changed, 5 insertions, 18 deletions
diff --git a/linux/include/media/v4l2-common.h b/linux/include/media/v4l2-common.h
index ca06eb8d5..8c534d476 100644
--- a/linux/include/media/v4l2-common.h
+++ b/linux/include/media/v4l2-common.h
@@ -135,7 +135,7 @@ struct v4l2_device;
struct v4l2_subdev;
struct v4l2_subdev_ops;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver,
const char *name,
int (*probe)(struct i2c_client *, const struct i2c_device_id *));
diff --git a/linux/include/media/v4l2-i2c-drv.h b/linux/include/media/v4l2-i2c-drv.h
index 38a26fc73..52898df94 100644
--- a/linux/include/media/v4l2-i2c-drv.h
+++ b/linux/include/media/v4l2-i2c-drv.h
@@ -44,11 +44,10 @@ struct v4l2_i2c_driver_data {
int (*remove)(struct i2c_client *client);
int (*suspend)(struct i2c_client *client, pm_message_t state);
int (*resume)(struct i2c_client *client);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
int (*legacy_probe)(struct i2c_adapter *adapter);
int legacy_class;
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+#else
const struct i2c_device_id *id_table;
#endif
};
@@ -56,31 +55,19 @@ 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, 22)
-#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, 26)
-/* Bus-based I2C implementation for kernels >= 2.6.22 */
+/* Bus-based I2C implementation for kernels >= 2.6.26 */
static int __init v4l2_i2c_drv_init(void)
{
v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
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;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table;
-#endif
return i2c_add_driver(&v4l2_i2c_driver);
}