* [PATCH 0/2] v4l2: standardize log start/end messages
@ 2012-01-27 17:59 Hans Verkuil
2012-01-27 17:59 ` [PATCH 1/2] v4l2: standardize log start/end message Hans Verkuil
0 siblings, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2012-01-27 17:59 UTC (permalink / raw)
To: linux-media
Cc: Mauro Carvalho Chehab, Andy Walls, Laurent Pinchart, Steven Toth
The output from VIDIOC_LOG_STATUS should be bracketed by a 'START STATUS' and
'END STATUS' line to clearly group the status report in the kernel log and to
make it possible for a tool like v4l2-ctl to easily find and show the status
output.
Often this was forgotten, so this is now done automatically as long as drivers
use the v4l2_device struct.
It was also added for the subdev nodes.
A new helper function was also added for drivers that just want to log the
current control values in the log.
Regards,
Hans
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] v4l2: standardize log start/end message.
2012-01-27 17:59 [PATCH 0/2] v4l2: standardize log start/end messages Hans Verkuil
@ 2012-01-27 17:59 ` Hans Verkuil
2012-01-27 17:59 ` [PATCH 2/2] v4l2-subdev: add start/end messages for log_status Hans Verkuil
2012-01-27 20:50 ` [PATCH 1/2] v4l2: standardize log start/end message Sylwester Nawrocki
0 siblings, 2 replies; 4+ messages in thread
From: Hans Verkuil @ 2012-01-27 17:59 UTC (permalink / raw)
To: linux-media
Cc: Mauro Carvalho Chehab, Andy Walls, Laurent Pinchart, Steven Toth,
Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
For drivers that properly use the v4l2 framework (i.e. set v4l2_dev in the
video_device struct), the start and end messages of VIDIOC_LOG_STATUS are
now generated automatically. People tended to forget these, but the v4l2-ctl
tool scans for these messages, and it also makes it easier to read the status
output in the kernel log.
In saa7164 two empty log_status functions were removed.
Also added a helper function to v4l2-ctrl.c that can be used as the
vidioc_log_status callback if all you need to do is to log the current control
values.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/video/bt8xx/bttv-driver.c | 4 ----
drivers/media/video/cx18/cx18-ioctl.c | 4 ----
drivers/media/video/ivtv/ivtv-ioctl.c | 5 -----
drivers/media/video/pwc/pwc-v4l.c | 10 +---------
drivers/media/video/saa7164/saa7164-encoder.c | 6 ------
drivers/media/video/saa7164/saa7164-vbi.c | 6 ------
drivers/media/video/v4l2-ctrls.c | 12 ++++++++++++
drivers/media/video/v4l2-ioctl.c | 8 ++++++++
drivers/media/video/vivi.c | 10 +---------
include/media/v4l2-ctrls.h | 4 ++++
10 files changed, 26 insertions(+), 43 deletions(-)
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 76c301f..e581b37 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2035,11 +2035,7 @@ static int bttv_log_status(struct file *file, void *f)
struct bttv_fh *fh = f;
struct bttv *btv = fh->btv;
- pr_info("%d: ======== START STATUS CARD #%d ========\n",
- btv->c.nr, btv->c.nr);
bttv_call_all(btv, core, log_status);
- pr_info("%d: ======== END STATUS CARD #%d ========\n",
- btv->c.nr, btv->c.nr);
return 0;
}
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index 66b1c15..be49f68 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -1085,8 +1085,6 @@ static int cx18_log_status(struct file *file, void *fh)
struct v4l2_audio audin;
int i;
- CX18_INFO("================= START STATUS CARD #%d "
- "=================\n", cx->instance);
CX18_INFO("Version: %s Card: %s\n", CX18_VERSION, cx->card_name);
if (cx->hw_flags & CX18_HW_TVEEPROM) {
struct tveeprom tv;
@@ -1120,8 +1118,6 @@ static int cx18_log_status(struct file *file, void *fh)
CX18_INFO("Read MPEG/VBI: %lld/%lld bytes\n",
(long long)cx->mpg_data_received,
(long long)cx->vbi_data_inserted);
- CX18_INFO("================== END STATUS CARD #%d "
- "==================\n", cx->instance);
return 0;
}
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index b063077..2c92b12 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -1479,8 +1479,6 @@ static int ivtv_log_status(struct file *file, void *fh)
struct v4l2_audio audin;
int i;
- IVTV_INFO("================= START STATUS CARD #%d =================\n",
- itv->instance);
IVTV_INFO("Version: %s Card: %s\n", IVTV_VERSION, itv->card_name);
if (itv->hw_flags & IVTV_HW_TVEEPROM) {
struct tveeprom tv;
@@ -1569,9 +1567,6 @@ static int ivtv_log_status(struct file *file, void *fh)
IVTV_INFO("Read MPG/VBI: %lld/%lld bytes\n",
(long long)itv->mpg_data_received,
(long long)itv->vbi_data_inserted);
- IVTV_INFO("================== END STATUS CARD #%d ==================\n",
- itv->instance);
-
return 0;
}
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index f495eeb..2834e3e 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -1146,14 +1146,6 @@ leave:
return ret;
}
-static int pwc_log_status(struct file *file, void *priv)
-{
- struct pwc_device *pdev = video_drvdata(file);
-
- v4l2_ctrl_handler_log_status(&pdev->ctrl_handler, PWC_NAME);
- return 0;
-}
-
const struct v4l2_ioctl_ops pwc_ioctl_ops = {
.vidioc_querycap = pwc_querycap,
.vidioc_enum_input = pwc_enum_input,
@@ -1169,7 +1161,7 @@ const struct v4l2_ioctl_ops pwc_ioctl_ops = {
.vidioc_dqbuf = pwc_dqbuf,
.vidioc_streamon = pwc_streamon,
.vidioc_streamoff = pwc_streamoff,
- .vidioc_log_status = pwc_log_status,
+ .vidioc_log_status = v4l2_ctrl_log_status,
.vidioc_enum_framesizes = pwc_enum_framesizes,
.vidioc_enum_frameintervals = pwc_enum_frameintervals,
.vidioc_g_parm = pwc_g_parm,
diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c
index 2fd38a0..a9ed686 100644
--- a/drivers/media/video/saa7164/saa7164-encoder.c
+++ b/drivers/media/video/saa7164/saa7164-encoder.c
@@ -791,11 +791,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
-static int vidioc_log_status(struct file *file, void *priv)
-{
- return 0;
-}
-
static int fill_queryctrl(struct saa7164_encoder_params *params,
struct v4l2_queryctrl *c)
{
@@ -1347,7 +1342,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_g_ext_ctrls = vidioc_g_ext_ctrls,
.vidioc_s_ext_ctrls = vidioc_s_ext_ctrls,
.vidioc_try_ext_ctrls = vidioc_try_ext_ctrls,
- .vidioc_log_status = vidioc_log_status,
.vidioc_queryctrl = vidioc_queryctrl,
.vidioc_g_chip_ident = saa7164_g_chip_ident,
#ifdef CONFIG_VIDEO_ADV_DEBUG
diff --git a/drivers/media/video/saa7164/saa7164-vbi.c b/drivers/media/video/saa7164/saa7164-vbi.c
index e2e0341..273cf80 100644
--- a/drivers/media/video/saa7164/saa7164-vbi.c
+++ b/drivers/media/video/saa7164/saa7164-vbi.c
@@ -730,11 +730,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
-static int vidioc_log_status(struct file *file, void *priv)
-{
- return 0;
-}
-
static int fill_queryctrl(struct saa7164_vbi_params *params,
struct v4l2_queryctrl *c)
{
@@ -1256,7 +1251,6 @@ static const struct v4l2_ioctl_ops vbi_ioctl_ops = {
.vidioc_g_ext_ctrls = vidioc_g_ext_ctrls,
.vidioc_s_ext_ctrls = vidioc_s_ext_ctrls,
.vidioc_try_ext_ctrls = vidioc_try_ext_ctrls,
- .vidioc_log_status = vidioc_log_status,
.vidioc_queryctrl = vidioc_queryctrl,
#if 0
.vidioc_g_chip_ident = saa7164_g_chip_ident,
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index cccd42b..d070688 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -2359,3 +2359,15 @@ void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl,
v4l2_ctrl_unlock(ctrl);
}
EXPORT_SYMBOL(v4l2_ctrl_del_event);
+
+int v4l2_ctrl_log_status(struct file *file, void *fh)
+{
+ struct video_device *vfd = video_devdata(file);
+ struct v4l2_fh *vfh = file->private_data;
+
+ if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) && vfd->v4l2_dev)
+ v4l2_ctrl_handler_log_status(vfh->ctrl_handler,
+ vfd->v4l2_dev->name);
+ return 0;
+}
+EXPORT_SYMBOL(v4l2_ctrl_log_status);
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index d0d7281..2348669 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1911,7 +1911,15 @@ static long __video_do_ioctl(struct file *file,
{
if (!ops->vidioc_log_status)
break;
+ if (vfd->v4l2_dev)
+ printk(KERN_INFO
+ "%s: ================= START STATUS =================\n",
+ vfd->v4l2_dev->name);
ret = ops->vidioc_log_status(file, fh);
+ if (vfd->v4l2_dev)
+ printk(KERN_INFO
+ "%s: ================== END STATUS ==================\n",
+ vfd->v4l2_dev->name);
break;
}
#ifdef CONFIG_VIDEO_ADV_DEBUG
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 84ea88d..cef8c91 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -959,14 +959,6 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
return vb2_streamoff(&dev->vb_vidq, i);
}
-static int vidioc_log_status(struct file *file, void *priv)
-{
- struct vivi_dev *dev = video_drvdata(file);
-
- v4l2_ctrl_handler_log_status(&dev->ctrl_handler, dev->v4l2_dev.name);
- return 0;
-}
-
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i)
{
return 0;
@@ -1210,7 +1202,7 @@ static const struct v4l2_ioctl_ops vivi_ioctl_ops = {
.vidioc_s_input = vidioc_s_input,
.vidioc_streamon = vidioc_streamon,
.vidioc_streamoff = vidioc_streamoff,
- .vidioc_log_status = vidioc_log_status,
+ .vidioc_log_status = v4l2_ctrl_log_status,
.vidioc_subscribe_event = vidioc_subscribe_event,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
};
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index eeb3df6..5f246c2 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -492,6 +492,10 @@ void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl,
struct v4l2_subscribed_event *sev);
+/* Can be used as a vidioc_log_status function that just dumps all controls
+ associated with the filehandle. */
+int v4l2_ctrl_log_status(struct file *file, void *fh);
+
/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
--
1.7.8.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] v4l2-subdev: add start/end messages for log_status.
2012-01-27 17:59 ` [PATCH 1/2] v4l2: standardize log start/end message Hans Verkuil
@ 2012-01-27 17:59 ` Hans Verkuil
2012-01-27 20:50 ` [PATCH 1/2] v4l2: standardize log start/end message Sylwester Nawrocki
1 sibling, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2012-01-27 17:59 UTC (permalink / raw)
To: linux-media
Cc: Mauro Carvalho Chehab, Andy Walls, Laurent Pinchart, Steven Toth,
Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
Add the start and end messages for log_status when called from a
subdev device node.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/video/v4l2-subdev.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
index 41d118e..07e39c3 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -194,8 +194,18 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
}
#endif
- case VIDIOC_LOG_STATUS:
- return v4l2_subdev_call(sd, core, log_status);
+ case VIDIOC_LOG_STATUS: {
+ int ret;
+
+ printk(KERN_INFO
+ "%s: ================= START STATUS =================\n",
+ sd->name);
+ ret = v4l2_subdev_call(sd, core, log_status);
+ printk(KERN_INFO
+ "%s: ================== END STATUS ==================\n",
+ sd->name);
+ return ret;
+ }
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
case VIDIOC_SUBDEV_G_FMT: {
--
1.7.8.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] v4l2: standardize log start/end message.
2012-01-27 17:59 ` [PATCH 1/2] v4l2: standardize log start/end message Hans Verkuil
2012-01-27 17:59 ` [PATCH 2/2] v4l2-subdev: add start/end messages for log_status Hans Verkuil
@ 2012-01-27 20:50 ` Sylwester Nawrocki
1 sibling, 0 replies; 4+ messages in thread
From: Sylwester Nawrocki @ 2012-01-27 20:50 UTC (permalink / raw)
To: Hans Verkuil
Cc: linux-media, Mauro Carvalho Chehab, Andy Walls, Laurent Pinchart,
Steven Toth, Hans Verkuil
Hello Hans,
On 01/27/2012 06:59 PM, Hans Verkuil wrote:
> diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
> index d0d7281..2348669 100644
> --- a/drivers/media/video/v4l2-ioctl.c
> +++ b/drivers/media/video/v4l2-ioctl.c
> @@ -1911,7 +1911,15 @@ static long __video_do_ioctl(struct file *file,
> {
> if (!ops->vidioc_log_status)
> break;
> + if (vfd->v4l2_dev)
> + printk(KERN_INFO
> + "%s: ================= START STATUS =================\n",
> + vfd->v4l2_dev->name);
> ret = ops->vidioc_log_status(file, fh);
> + if (vfd->v4l2_dev)
> + printk(KERN_INFO
> + "%s: ================== END STATUS ==================\n",
> + vfd->v4l2_dev->name);
Nice cleanup, but wouldn't it be more appropriate to use pr_info() here
instead ? AFAIK this is preferred logging style now.
--
Thanks,
Sylwester
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-27 20:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-27 17:59 [PATCH 0/2] v4l2: standardize log start/end messages Hans Verkuil
2012-01-27 17:59 ` [PATCH 1/2] v4l2: standardize log start/end message Hans Verkuil
2012-01-27 17:59 ` [PATCH 2/2] v4l2-subdev: add start/end messages for log_status Hans Verkuil
2012-01-27 20:50 ` [PATCH 1/2] v4l2: standardize log start/end message Sylwester Nawrocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.