parts of the bridge chip such as an AC97 register block.</para>
<para>When <structfield>match.type</structfield> is
-<constant>V4L2_CHIP_MATCH_SUBDEV_NAME</constant>,
-<structfield>match.name</structfield> contains the name of a sub-device.
-For instance
-<constant>"saa7127 6-0044"</constant> will match the saa7127 sub-device
-at the given i2c bus. This match type is not very useful for this ioctl
-and is here only for consistency.
-</para>
-
- <para>When <structfield>match.type</structfield> is
-<constant>V4L2_CHIP_MATCH_SUBDEV_IDX</constant>,
+<constant>V4L2_CHIP_MATCH_SUBDEV</constant>,
<structfield>match.addr</structfield> selects the nth sub-device. This
allows you to enumerate over all sub-devices.</para>
<entry>Match the nth anciliary AC97 chip. Can't be used with this ioctl.</entry>
</row>
<row>
- <entry><constant>V4L2_CHIP_MATCH_SUBDEV_NAME</constant></entry>
+ <entry><constant>V4L2_CHIP_MATCH_SUBDEV</constant></entry>
<entry>4</entry>
- <entry>Match the sub-device by name.</entry>
- </row>
- <row>
- <entry><constant>V4L2_CHIP_MATCH_SUBDEV_IDX</constant></entry>
- <entry>5</entry>
<entry>Match the nth sub-device.</entry>
</row>
</tbody>
on the TV card.</para>
<para>When <structfield>match.type</structfield> is
-<constant>V4L2_CHIP_MATCH_SUBDEV_NAME</constant>,
-<structfield>match.name</structfield> contains the sub-device name.
-For instance
-<constant>"saa7127 6-0044"</constant> will match this specific saa7127
-sub-device. Again with the &VIDIOC-DBG-G-CHIP-NAME; ioctl you can find
-out which sub-devices are present.</para>
-
- <para>When <structfield>match.type</structfield> is
-<constant>V4L2_CHIP_MATCH_SUBDEV_IDX</constant>,
+<constant>V4L2_CHIP_MATCH_SUBDEV</constant>,
<structfield>match.addr</structfield> selects the nth sub-device.</para>
<note>
<entry>Match the nth anciliary AC97 chip.</entry>
</row>
<row>
- <entry><constant>V4L2_CHIP_MATCH_SUBDEV_NAME</constant></entry>
+ <entry><constant>V4L2_CHIP_MATCH_SUBDEV</constant></entry>
<entry>4</entry>
- <entry>Match the sub-device by name.</entry>
- </row>
- <row>
- <entry><constant>V4L2_CHIP_MATCH_SUBDEV_IDX</constant></entry>
- <entry>5</entry>
<entry>Match the nth sub-device.</entry>
</row>
</tbody>
const struct v4l2_dbg_chip_ident *p = arg;
pr_cont("type=%u, ", p->match.type);
- if (p->match.type == V4L2_CHIP_MATCH_I2C_DRIVER ||
- p->match.type == V4L2_CHIP_MATCH_SUBDEV_NAME)
+ if (p->match.type == V4L2_CHIP_MATCH_I2C_DRIVER)
pr_cont("name=%.*s, ",
(int)sizeof(p->match.name), p->match.name);
else
const struct v4l2_dbg_chip_name *p = arg;
pr_cont("type=%u, ", p->match.type);
- if (p->match.type == V4L2_CHIP_MATCH_I2C_DRIVER ||
- p->match.type == V4L2_CHIP_MATCH_SUBDEV_NAME)
+ if (p->match.type == V4L2_CHIP_MATCH_I2C_DRIVER)
pr_cont("name=%.*s, ",
(int)sizeof(p->match.name), p->match.name);
else
const struct v4l2_dbg_register *p = arg;
pr_cont("type=%u, ", p->match.type);
- if (p->match.type == V4L2_CHIP_MATCH_I2C_DRIVER ||
- p->match.type == V4L2_CHIP_MATCH_SUBDEV_NAME)
+ if (p->match.type == V4L2_CHIP_MATCH_I2C_DRIVER)
pr_cont("name=%.*s, ",
(int)sizeof(p->match.name), p->match.name);
else
return ret;
}
-static bool v4l_dbg_found_match(const struct v4l2_dbg_match *match,
- struct v4l2_subdev *sd, int idx)
-{
- if (match->type == V4L2_CHIP_MATCH_SUBDEV_IDX)
- return match->addr == idx;
- return !strcmp(match->name, sd->name);
-}
-
static int v4l_dbg_g_register(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
{
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (p->match.type == V4L2_CHIP_MATCH_SUBDEV_IDX ||
- p->match.type == V4L2_CHIP_MATCH_SUBDEV_NAME) {
+ if (p->match.type == V4L2_CHIP_MATCH_SUBDEV) {
if (vfd->v4l2_dev == NULL)
return -EINVAL;
- v4l2_device_for_each_subdev(sd, vfd->v4l2_dev) {
- if (v4l_dbg_found_match(&p->match, sd, idx++))
+ v4l2_device_for_each_subdev(sd, vfd->v4l2_dev)
+ if (p->match.addr == idx++)
return v4l2_subdev_call(sd, core, g_register, p);
- }
return -EINVAL;
}
if (ops->vidioc_g_register)
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (p->match.type == V4L2_CHIP_MATCH_SUBDEV_IDX ||
- p->match.type == V4L2_CHIP_MATCH_SUBDEV_NAME) {
+ if (p->match.type == V4L2_CHIP_MATCH_SUBDEV) {
if (vfd->v4l2_dev == NULL)
return -EINVAL;
- v4l2_device_for_each_subdev(sd, vfd->v4l2_dev) {
- if (v4l_dbg_found_match(&p->match, sd, idx++))
+ v4l2_device_for_each_subdev(sd, vfd->v4l2_dev)
+ if (p->match.addr == idx++)
return v4l2_subdev_call(sd, core, s_register, p);
- }
return -EINVAL;
}
if (ops->vidioc_s_register)
p->ident = V4L2_IDENT_NONE;
p->revision = 0;
- if (p->match.type == V4L2_CHIP_MATCH_SUBDEV_NAME ||
- p->match.type == V4L2_CHIP_MATCH_SUBDEV_IDX)
+ if (p->match.type == V4L2_CHIP_MATCH_SUBDEV)
return -EINVAL;
return ops->vidioc_g_chip_ident(file, fh, p);
}
strlcpy(p->name, "bridge", sizeof(p->name));
return 0;
- case V4L2_CHIP_MATCH_SUBDEV_IDX:
- case V4L2_CHIP_MATCH_SUBDEV_NAME:
+ case V4L2_CHIP_MATCH_SUBDEV:
if (vfd->v4l2_dev == NULL)
break;
v4l2_device_for_each_subdev(sd, vfd->v4l2_dev) {
- if (v4l_dbg_found_match(&p->match, sd, idx++)) {
- if (sd->ops->core && sd->ops->core->s_register)
- p->flags |= V4L2_CHIP_FL_WRITABLE;
- if (sd->ops->core && sd->ops->core->g_register)
- p->flags |= V4L2_CHIP_FL_READABLE;
- strlcpy(p->name, sd->name, sizeof(p->name));
- return 0;
- }
+ if (p->match.addr != idx++)
+ continue;
+ if (sd->ops->core && sd->ops->core->s_register)
+ p->flags |= V4L2_CHIP_FL_WRITABLE;
+ if (sd->ops->core && sd->ops->core->g_register)
+ p->flags |= V4L2_CHIP_FL_READABLE;
+ strlcpy(p->name, sd->name, sizeof(p->name));
+ return 0;
}
break;
}