summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-04-01 08:32:22 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2009-04-01 08:32:22 +0200
commit960b146f6788947695ab1ffb6965617263399f5f (patch)
tree288a71ec3a4746608bb31cc431c95d8e088ccb6d
parent781dcf110fb80cdf01c81c5b28fc65a8a4f130da (diff)
downloadmediapointer-dvb-s2-960b146f6788947695ab1ffb6965617263399f5f.tar.gz
mediapointer-dvb-s2-960b146f6788947695ab1ffb6965617263399f5f.tar.bz2
tuner: remove i2c legacy code.
From: Hans Verkuil <hverkuil@xs4all.nl> All drivers that use the tuner module now use v4l2_subdev, so we can remove the legacy code from this module. Note that TUNER_SET_CONFIG is still called by tuner-simple.c, so we have to handle it via a .command callback. There must be a better way to do this, but for now this will work. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
-rw-r--r--linux/drivers/media/video/tuner-core.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 0ac702201..dda992109 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -16,12 +16,12 @@
#include <linux/types.h>
#include <linux/init.h>
#include "compat.h"
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
#include <media/tuner.h>
#include <media/tuner-types.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
-#include <media/v4l2-i2c-drv-legacy.h>
+#include <media/v4l2-i2c-drv.h>
#include "mt20xx.h"
#include "tda8290.h"
#include "tea5761.h"
@@ -102,6 +102,7 @@ static inline struct tuner *to_tuner(struct v4l2_subdev *sd)
return container_of(sd, struct tuner, sd);
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
/* standard i2c insmod options */
static unsigned short normal_i2c[] = {
#if defined(CONFIG_MEDIA_TUNER_TEA5761) || (defined(CONFIG_MEDIA_TUNER_TEA5761_MODULE) && defined(MODULE))
@@ -114,6 +115,7 @@ static unsigned short normal_i2c[] = {
};
I2C_CLIENT_INSMOD;
+#endif
/* insmod options used at init time => read/only */
static unsigned int addr;
@@ -961,11 +963,6 @@ static int tuner_log_status(struct v4l2_subdev *sd)
return 0;
}
-static int tuner_command(struct i2c_client *client, unsigned cmd, void *arg)
-{
- return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg);
-}
-
static int tuner_suspend(struct i2c_client *c, pm_message_t state)
{
struct tuner *t = to_tuner(i2c_get_clientdata(c));
@@ -990,6 +987,20 @@ static int tuner_resume(struct i2c_client *c)
return 0;
}
+static int tuner_command(struct i2c_client *client, unsigned cmd, void *arg)
+{
+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
+
+ /* TUNER_SET_CONFIG is still called by tuner-simple.c, so we have
+ to handle it here.
+ There must be a better way of doing this... */
+ switch (cmd) {
+ case TUNER_SET_CONFIG:
+ return tuner_s_config(sd, arg);
+ }
+ return -ENOIOCTLCMD;
+}
+
/* ----------------------------------------------------------------------- */
static const struct v4l2_subdev_core_ops tuner_core_ops = {
@@ -1177,6 +1188,7 @@ register_client:
return 0;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static int tuner_legacy_probe(struct i2c_adapter *adap)
{
if (0 != addr) {
@@ -1210,6 +1222,7 @@ static int tuner_legacy_probe(struct i2c_adapter *adap)
}
return 1;
}
+#endif
static int tuner_remove(struct i2c_client *client)
{
@@ -1239,13 +1252,14 @@ MODULE_DEVICE_TABLE(i2c, tuner_id);
static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "tuner",
- .driverid = I2C_DRIVERID_TUNER,
- .command = tuner_command,
.probe = tuner_probe,
.remove = tuner_remove,
+ .command = tuner_command,
.suspend = tuner_suspend,
.resume = tuner_resume,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
.legacy_probe = tuner_legacy_probe,
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
.id_table = tuner_id,
#endif