Revert "[media] v4l2-ioctl: simplify code"

There are some issues rised on this patch during patch review.
I ended by merging this one by mistake. So, let's revert it.

This reverts commit 54ace1cfd4.

Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
Mauro Carvalho Chehab 2016-04-13 19:08:55 -03:00
parent 6ad9ba9c14
commit c431cbbb44

View File

@ -2160,41 +2160,34 @@ static int v4l_cropcap(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg) struct file *file, void *fh, void *arg)
{ {
struct v4l2_cropcap *p = arg; struct v4l2_cropcap *p = arg;
struct v4l2_selection s = { .type = p->type };
int ret;
if (ops->vidioc_g_selection == NULL) { if (ops->vidioc_g_selection) {
/* struct v4l2_selection s = { .type = p->type };
* The determine_valid_ioctls() call already should ensure int ret;
* that ops->vidioc_cropcap != NULL, but just in case...
*/ /* obtaining bounds */
if (ops->vidioc_cropcap) if (V4L2_TYPE_IS_OUTPUT(p->type))
return ops->vidioc_cropcap(file, fh, p); s.target = V4L2_SEL_TGT_COMPOSE_BOUNDS;
return -ENOTTY; else
s.target = V4L2_SEL_TGT_CROP_BOUNDS;
ret = ops->vidioc_g_selection(file, fh, &s);
if (ret)
return ret;
p->bounds = s.r;
/* obtaining defrect */
if (V4L2_TYPE_IS_OUTPUT(p->type))
s.target = V4L2_SEL_TGT_COMPOSE_DEFAULT;
else
s.target = V4L2_SEL_TGT_CROP_DEFAULT;
ret = ops->vidioc_g_selection(file, fh, &s);
if (ret)
return ret;
p->defrect = s.r;
} }
/* obtaining bounds */
if (V4L2_TYPE_IS_OUTPUT(p->type))
s.target = V4L2_SEL_TGT_COMPOSE_BOUNDS;
else
s.target = V4L2_SEL_TGT_CROP_BOUNDS;
ret = ops->vidioc_g_selection(file, fh, &s);
if (ret)
return ret;
p->bounds = s.r;
/* obtaining defrect */
if (V4L2_TYPE_IS_OUTPUT(p->type))
s.target = V4L2_SEL_TGT_COMPOSE_DEFAULT;
else
s.target = V4L2_SEL_TGT_CROP_DEFAULT;
ret = ops->vidioc_g_selection(file, fh, &s);
if (ret)
return ret;
p->defrect = s.r;
/* setting trivial pixelaspect */ /* setting trivial pixelaspect */
p->pixelaspect.numerator = 1; p->pixelaspect.numerator = 1;
p->pixelaspect.denominator = 1; p->pixelaspect.denominator = 1;