[media] v4l2-ioctl: fill in name before calling vidioc_g_chip_name

That way drivers do not need to fill in the name themselves for bridge address 0.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Hans Verkuil 2013-04-06 06:06:13 -03:00 committed by Mauro Carvalho Chehab
parent 3eef25107c
commit 0f0fe4b9f6
1 changed files with 4 additions and 4 deletions

View File

@ -1869,16 +1869,16 @@ static int v4l_dbg_g_chip_name(const struct v4l2_ioctl_ops *ops,
p->flags |= V4L2_CHIP_FL_WRITABLE; p->flags |= V4L2_CHIP_FL_WRITABLE;
if (ops->vidioc_g_register) if (ops->vidioc_g_register)
p->flags |= V4L2_CHIP_FL_READABLE; p->flags |= V4L2_CHIP_FL_READABLE;
if (ops->vidioc_g_chip_name)
return ops->vidioc_g_chip_name(file, fh, arg);
if (p->match.addr)
return -EINVAL;
if (vfd->v4l2_dev) if (vfd->v4l2_dev)
strlcpy(p->name, vfd->v4l2_dev->name, sizeof(p->name)); strlcpy(p->name, vfd->v4l2_dev->name, sizeof(p->name));
else if (vfd->parent) else if (vfd->parent)
strlcpy(p->name, vfd->parent->driver->name, sizeof(p->name)); strlcpy(p->name, vfd->parent->driver->name, sizeof(p->name));
else else
strlcpy(p->name, "bridge", sizeof(p->name)); strlcpy(p->name, "bridge", sizeof(p->name));
if (ops->vidioc_g_chip_name)
return ops->vidioc_g_chip_name(file, fh, arg);
if (p->match.addr)
return -EINVAL;
return 0; return 0;
case V4L2_CHIP_MATCH_SUBDEV: case V4L2_CHIP_MATCH_SUBDEV: