]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (10691): v4l2-common: add v4l2_i2c_subdev_addr()
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 21 Feb 2009 21:08:41 +0000 (18:08 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:54 +0000 (12:42 -0300)
Add small function to retrieve the i2c address from a v4l2_subdev
pointer.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-common.c
include/media/v4l2-common.h

index bca4daf87a120c35ed95d32d2026f6dd5d418f8e..caa7ba0705a5c0e96f4e180241de766c1d242052 100644 (file)
@@ -1022,6 +1022,15 @@ struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter,
 }
 EXPORT_SYMBOL_GPL(v4l2_i2c_new_probed_subdev);
 
+/* Return i2c client address of v4l2_subdev. */
+unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd)
+{
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+
+       return client ? client->addr : I2C_CLIENT_END;
+}
+EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_addr);
+
 /* Return a list of I2C tuner addresses to probe. Use only if the tuner
    addresses are unknown. */
 const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type)
index de785da4564c3a5ca824a11211dd916397ad940b..7779d9c93ec859f5be73d897d4b7493aa479fcf2 100644 (file)
@@ -154,6 +154,8 @@ struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter,
 /* Initialize an v4l2_subdev with data from an i2c_client struct */
 void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
                const struct v4l2_subdev_ops *ops);
+/* Return i2c client address of v4l2_subdev. */
+unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd);
 
 enum v4l2_i2c_tuner_type {
        ADDRS_RADIO,    /* Radio tuner addresses */