Skip to content

Commit

Permalink
[media] v4l2-ioctl: WARN_ON if querycap didn't fill device_caps
Browse files Browse the repository at this point in the history
This is easy to forget to do in drivers. While v4l2-compliance will check for it,
not everyone remembers to run it. So warn about it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Dec 17, 2014
1 parent bb9ff07 commit 454a4e7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/media/v4l2-core/v4l2-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,12 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
ret = ops->vidioc_querycap(file, fh, cap);

cap->capabilities |= V4L2_CAP_EXT_PIX_FORMAT;
/*
* Drivers MUST fill in device_caps, so check for this and
* warn if it was forgotten.
*/
WARN_ON(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
!cap->device_caps);
cap->device_caps |= V4L2_CAP_EXT_PIX_FORMAT;

return ret;
Expand Down

0 comments on commit 454a4e7

Please sign in to comment.