aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-common.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-12-30 05:14:19 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-01-02 14:11:52 -0500
commitaecde8b53b8ee1330a5a8206200f0d6b8845a6e0 (patch)
tree53a1aef6597a9d829864c054230b312010abc3a7 /drivers/media/video/v4l2-common.c
parentda1b5c95e49bb564ae8c61ed135d34ed09acbb66 (diff)
V4L/DVB (10141): v4l2: debugging API changed to match against driver name instead of ID.
Since the i2c driver ID will be removed in the near future we have to modify the v4l2 debugging API to use the driver name instead of driver ID. Note that this API is not used in applications other than v4l2-dbg.cpp as it is for debugging and testing only. Should anyone use the old VIDIOC_G_CHIP_IDENT, then this will be logged with a warning that it is deprecated and will be removed in 2.6.30. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-common.c')
-rw-r--r--drivers/media/video/v4l2-common.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index c676b0b0f708..b8f2be8d5c0e 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -797,11 +797,11 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
797} 797}
798EXPORT_SYMBOL(v4l2_ctrl_next); 798EXPORT_SYMBOL(v4l2_ctrl_next);
799 799
800int v4l2_chip_match_host(u32 match_type, u32 match_chip) 800int v4l2_chip_match_host(const struct v4l2_dbg_match *match)
801{ 801{
802 switch (match_type) { 802 switch (match->type) {
803 case V4L2_CHIP_MATCH_HOST: 803 case V4L2_CHIP_MATCH_HOST:
804 return match_chip == 0; 804 return match->addr == 0;
805 default: 805 default:
806 return 0; 806 return 0;
807 } 807 }
@@ -809,23 +809,34 @@ int v4l2_chip_match_host(u32 match_type, u32 match_chip)
809EXPORT_SYMBOL(v4l2_chip_match_host); 809EXPORT_SYMBOL(v4l2_chip_match_host);
810 810
811#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) 811#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
812int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) 812int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match)
813{ 813{
814 switch (match_type) { 814 int len;
815
816 if (c == NULL || match == NULL)
817 return 0;
818
819 switch (match->type) {
815 case V4L2_CHIP_MATCH_I2C_DRIVER: 820 case V4L2_CHIP_MATCH_I2C_DRIVER:
816 return (c != NULL && c->driver != NULL && c->driver->id == match_chip); 821 if (c->driver == NULL || c->driver->driver.name == NULL)
822 return 0;
823 len = strlen(c->driver->driver.name);
824 /* legacy drivers have a ' suffix, don't try to match that */
825 if (len && c->driver->driver.name[len - 1] == '\'')
826 len--;
827 return len && !strncmp(c->driver->driver.name, match->name, len);
817 case V4L2_CHIP_MATCH_I2C_ADDR: 828 case V4L2_CHIP_MATCH_I2C_ADDR:
818 return (c != NULL && c->addr == match_chip); 829 return c->addr == match->addr;
819 default: 830 default:
820 return 0; 831 return 0;
821 } 832 }
822} 833}
823EXPORT_SYMBOL(v4l2_chip_match_i2c_client); 834EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
824 835
825int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, 836int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip,
826 u32 ident, u32 revision) 837 u32 ident, u32 revision)
827{ 838{
828 if (!v4l2_chip_match_i2c_client(c, chip->match_type, chip->match_chip)) 839 if (!v4l2_chip_match_i2c_client(c, &chip->match))
829 return 0; 840 return 0;
830 if (chip->ident == V4L2_IDENT_NONE) { 841 if (chip->ident == V4L2_IDENT_NONE) {
831 chip->ident = ident; 842 chip->ident = ident;