The patch number 9962 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]>
tea6420: convert to v4l2_subdev.
Priority: normal
Signed-off-by: Hans Verkuil <[email protected]>
---
linux/drivers/media/video/tea6420.c | 51 ++++++++++++++++++++--------
1 file changed, 38 insertions(+), 13 deletions(-)
diff -r 22e6bf3102c1 -r f555fd275335 linux/drivers/media/video/tea6420.c
--- a/linux/drivers/media/video/tea6420.c Thu Dec 18 16:29:07 2008 +0100
+++ b/linux/drivers/media/video/tea6420.c Thu Dec 18 16:33:45 2008 +0100
@@ -31,7 +31,7 @@
#include <linux/module.h>
#include <linux/ioctl.h>
#include <linux/i2c.h>
-#include <media/v4l2-common.h>
+#include <media/v4l2-device.h>
#include <media/v4l2-i2c-drv-legacy.h>
#include "tea6420.h"
#include "compat.h"
@@ -91,26 +91,37 @@ static int tea6420_switch(struct i2c_cli
return 0;
}
+static int tea6420_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg)
+{
+ if (cmd == TEA6420_SWITCH) {
+ struct i2c_client *client = v4l2_get_subdevdata(sd);
+ struct tea6420_multiplex *a = (struct tea6420_multiplex *)arg;
+
+ return tea6420_switch(client, a->in, a->out, a->gain);
+ }
+ return -ENOIOCTLCMD;
+}
+
static int tea6420_command(struct i2c_client *client, unsigned cmd, void *arg)
{
- struct tea6420_multiplex *a = (struct tea6420_multiplex *)arg;
- int result = 0;
+ return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg);
+}
- switch (cmd) {
- case TEA6420_SWITCH:
- result = tea6420_switch(client, a->in, a->out, a->gain);
- break;
- default:
- return -ENOIOCTLCMD;
- }
+/* ----------------------------------------------------------------------- */
- return result;
-}
+static const struct v4l2_subdev_core_ops tea6420_core_ops = {
+ .ioctl = tea6420_ioctl,
+};
+
+static const struct v4l2_subdev_ops tea6420_ops = {
+ .core = &tea6420_core_ops,
+};
/* this function is called by i2c_probe */
static int tea6420_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
+ struct v4l2_subdev *sd;
int err, i;
/* let's see whether this adapter can support what we need */
@@ -127,9 +138,22 @@ static int tea6420_probe(struct i2c_clie
}
if (err) {
v4l_dbg(1, debug, client, "could not initialize tea6420\n");
- kfree(client);
return -ENODEV;
}
+
+ sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
+ if (sd == NULL)
+ return -ENOMEM;
+ v4l2_i2c_subdev_init(sd, client, &tea6420_ops);
+ return 0;
+}
+
+static int tea6420_remove(struct i2c_client *client)
+{
+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
+
+ v4l2_device_unregister_subdev(sd);
+ kfree(sd);
return 0;
}
@@ -153,6 +177,7 @@ static struct v4l2_i2c_driver_data v4l2_
.driverid = I2C_DRIVERID_TEA6420,
.command = tea6420_command,
.probe = tea6420_probe,
+ .remove = tea6420_remove,
.legacy_probe = tea6420_legacy_probe,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
.id_table = tea6420_id,
---
Patch is available at:
http://linuxtv.org/hg/v4l-dvb/rev/f555fd275335c7fe3832d85e295832ab46c85eda
_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits