aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-03-03 23:21:02 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:05 -0400
commit51f0b8d57af501624ee55e8ca15d09d5bdc2b0dd (patch)
tree095d574cc559f813ca7d2da2642b7431b661f4bb /drivers
parent337f9d205972bfe1cb7982384fd0f4caa4af001d (diff)
V4L/DVB (10813): v4l2: New function v4l2_video_std_frame_period
Some code was calling v4l2_video_std_construct() when all it cared about was the frame period. So make a function that just returns that and have v4l2_video_std_construct() use it. At this point there are no users of v4l2_video_std_construct() left outside of v4l2-ioctl, so it could be un-exported and made static. Change v4l2_video_std_construct() so that it doesn't zero out the struct v4l2_standard passed in. It's already been zeroed out in the common ioctl code. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c6
-rw-r--r--drivers/media/video/v4l2-ioctl.c39
2 files changed, 20 insertions, 25 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 826ca60b42e..1f606d816a5 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2932,13 +2932,11 @@ static int bttv_g_parm(struct file *file, void *f,
2932{ 2932{
2933 struct bttv_fh *fh = f; 2933 struct bttv_fh *fh = f;
2934 struct bttv *btv = fh->btv; 2934 struct bttv *btv = fh->btv;
2935 struct v4l2_standard s;
2936 2935
2937 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 2936 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
2938 return -EINVAL; 2937 return -EINVAL;
2939 v4l2_video_std_construct(&s, bttv_tvnorms[btv->tvnorm].v4l2_id, 2938 v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id,
2940 bttv_tvnorms[btv->tvnorm].name); 2939 &parm->parm.capture.timeperframe);
2941 parm->parm.capture.timeperframe = s.frameperiod;
2942 return 0; 2940 return 0;
2943} 2941}
2944 2942
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 64b4fda08dd..efbc4700465 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -101,25 +101,27 @@ const char *v4l2_norm_to_name(v4l2_std_id id)
101} 101}
102EXPORT_SYMBOL(v4l2_norm_to_name); 102EXPORT_SYMBOL(v4l2_norm_to_name);
103 103
104/* Returns frame period for the given standard */
105void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod)
106{
107 if (id & V4L2_STD_525_60) {
108 frameperiod->numerator = 1001;
109 frameperiod->denominator = 30000;
110 } else {
111 frameperiod->numerator = 1;
112 frameperiod->denominator = 25;
113 }
114}
115EXPORT_SYMBOL(v4l2_video_std_frame_period);
116
104/* Fill in the fields of a v4l2_standard structure according to the 117/* Fill in the fields of a v4l2_standard structure according to the
105 'id' and 'transmission' parameters. Returns negative on error. */ 118 'id' and 'transmission' parameters. Returns negative on error. */
106int v4l2_video_std_construct(struct v4l2_standard *vs, 119int v4l2_video_std_construct(struct v4l2_standard *vs,
107 int id, const char *name) 120 int id, const char *name)
108{ 121{
109 u32 index = vs->index; 122 vs->id = id;
110 123 v4l2_video_std_frame_period(id, &vs->frameperiod);
111 memset(vs, 0, sizeof(struct v4l2_standard)); 124 vs->framelines = (id & V4L2_STD_525_60) ? 525 : 625;
112 vs->index = index;
113 vs->id = id;
114 if (id & V4L2_STD_525_60) {
115 vs->frameperiod.numerator = 1001;
116 vs->frameperiod.denominator = 30000;
117 vs->framelines = 525;
118 } else {
119 vs->frameperiod.numerator = 1;
120 vs->frameperiod.denominator = 25;
121 vs->framelines = 625;
122 }
123 strlcpy(vs->name, name, sizeof(vs->name)); 125 strlcpy(vs->name, name, sizeof(vs->name));
124 return 0; 126 return 0;
125} 127}
@@ -1076,7 +1078,6 @@ static long __video_do_ioctl(struct file *file,
1076 return -EINVAL; 1078 return -EINVAL;
1077 1079
1078 v4l2_video_std_construct(p, curr_id, descr); 1080 v4l2_video_std_construct(p, curr_id, descr);
1079 p->index = index;
1080 1081
1081 dbgarg(cmd, "index=%d, id=0x%Lx, name=%s, fps=%d/%d, " 1082 dbgarg(cmd, "index=%d, id=0x%Lx, name=%s, fps=%d/%d, "
1082 "framelines=%d\n", p->index, 1083 "framelines=%d\n", p->index,
@@ -1565,15 +1566,11 @@ static long __video_do_ioctl(struct file *file,
1565 if (ops->vidioc_g_parm) { 1566 if (ops->vidioc_g_parm) {
1566 ret = ops->vidioc_g_parm(file, fh, p); 1567 ret = ops->vidioc_g_parm(file, fh, p);
1567 } else { 1568 } else {
1568 struct v4l2_standard s;
1569
1570 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1569 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1571 return -EINVAL; 1570 return -EINVAL;
1572 1571
1573 v4l2_video_std_construct(&s, vfd->current_norm, 1572 v4l2_video_std_frame_period(vfd->current_norm,
1574 v4l2_norm_to_name(vfd->current_norm)); 1573 &p->parm.capture.timeperframe);
1575
1576 p->parm.capture.timeperframe = s.frameperiod;
1577 ret = 0; 1574 ret = 0;
1578 } 1575 }
1579 1576