Skip to content

Commit

Permalink
[media] v4l2-ioctl: simplify debug code
Browse files Browse the repository at this point in the history
The core debug code can now be simplified since all the write-only ioctls are
now const and will not modify the data they pass to the drivers.
So instead of logging write-only ioctls before the driver is called this can
now be done afterwards, which is cleaner when it comes to error reporting as
well.
This also fixes a logic error in the debugging code where there was one 'else'
too many.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 24, 2013
1 parent 977ba3b commit 505d04b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions drivers/media/v4l2-core/v4l2-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2155,11 +2155,6 @@ static long __video_do_ioctl(struct file *file,
}

write_only = _IOC_DIR(cmd) == _IOC_WRITE;
if (write_only && debug > V4L2_DEBUG_IOCTL) {
v4l_printk_ioctl(video_device_node_name(vfd), cmd);
pr_cont(": ");
info->debug(arg, write_only);
}
if (info->flags & INFO_FL_STD) {
typedef int (*vidioc_op)(struct file *file, void *fh, void *p);
const void *p = vfd->ioctl_ops;
Expand All @@ -2178,16 +2173,10 @@ static long __video_do_ioctl(struct file *file,

done:
if (debug) {
if (write_only && debug > V4L2_DEBUG_IOCTL) {
if (ret < 0)
printk(KERN_DEBUG "%s: error %ld\n",
video_device_node_name(vfd), ret);
return ret;
}
v4l_printk_ioctl(video_device_node_name(vfd), cmd);
if (ret < 0)
pr_cont(": error %ld\n", ret);
else if (debug == V4L2_DEBUG_IOCTL)
pr_cont(": error %ld", ret);
if (debug == V4L2_DEBUG_IOCTL)
pr_cont("\n");
else if (_IOC_DIR(cmd) == _IOC_NONE)
info->debug(arg, write_only);
Expand Down

0 comments on commit 505d04b

Please sign in to comment.