Re: [RFCv1 PATCH 29/32] v4l2-dev.c: also add debug support for the fops.
On Mon June 18 2012 14:19:51 Laurent Pinchart wrote:
> Hi Hans,
>
> On Monday 18 June 2012 13:40:24 Hans Verkuil wrote:
> > On Mon June 18 2012 12:01:47 Laurent Pinchart wrote:
> > > On Sunday 10 June 2012 12:25:51 Hans Verkuil wrote:
> > > > From: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> > > >
> > > > Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> > > > ---
> > > >
> > > > drivers/media/video/v4l2-dev.c | 41 ++++++++++++++++++++++-----------
> > > > 1 file changed, 29 insertions(+), 12 deletions(-)
> > > >
> > > > diff --git a/drivers/media/video/v4l2-dev.c
> > > > b/drivers/media/video/v4l2-dev.c index 5c0bb18..54f387d 100644
> > > > --- a/drivers/media/video/v4l2-dev.c
> > > > +++ b/drivers/media/video/v4l2-dev.c
> > > > @@ -305,6 +305,9 @@ static ssize_t v4l2_read(struct file *filp, char
> > > > __user
> > > > *buf, ret = vdev->fops->read(filp, buf, sz, off);
> > > >
> > > > if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags))
> > > >
> > > > mutex_unlock(vdev->lock);
> > > >
> > > > + if (vdev->debug)
> > >
> > > As vdev->debug is a bitmask, shouldn't we add an fops debug bit ?
> >
> > I actually want to move away from the bitmask idea. I've never really liked
> > it here.
>
> Would using dev_dbg with dynamic printk instead of creating our own logging
> system be an option ?
I don't think so. There are lots of printk message you'd all have to enable.
You just want to have a standard method of debugging which ioctls are called
that anyone can use and that's consistent for all v4l drivers.
This does just that.
>
> > > > + pr_info("%s: read: %zd (%d)\n",
> > > > + video_device_node_name(vdev), sz, ret);
> > >
> > > Shouldn't we use KERN_DEBUG instead of KERN_INFO ? BTW, what about
> > > replacing the pr_* calls with dev_* calls ?
> >
> > KERN_DEBUG vs KERN_INFO is actually a good question. My reasoning is that
> > you explicitly enable logging, and so you really want to see it in the log,
> > so we use KERN_INFO. With KERN_DEBUG you might have the situation where the
> > debug level of the logging is disabled, so the messages are ignored.
> >
> > However, if people disagree with this, then I'm happy to move it back to
> > KERN_DEBUG.
>
> On embedded systems KERN_INFO will be printed to the serial console.
> Interleaving kernel messages with application output during capture result in
> a mess.
>
> If someone enables debugging I expect him/her to know enough to get the kernel
> log debug messages.
OK, I'll change this back to KERN_DEBUG. Good argument.
Regards,
Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Input]
[Video for Linux]
[Mplayer Users]
[Linux USB Devel]
[Linux Audio Users]
[Photos]
[Yosemite Photos]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Devices]
[Yosemite Backpacking]