From patchwork Mon Nov 5 23:14:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1701431 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5628CDF2AB for ; Mon, 5 Nov 2012 23:15:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550Ab2KEXPB (ORCPT ); Mon, 5 Nov 2012 18:15:01 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:57720 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751347Ab2KEXO7 (ORCPT ); Mon, 5 Nov 2012 18:14:59 -0500 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3XwV8x1Nygz4KKDG; Tue, 6 Nov 2012 00:14:57 +0100 (CET) X-Auth-Info: xCnSweg6npwmpHDP6aR6jb9SkFOjwJbLpxlg4ThWBX0= Received: from localhost (pD9E2FB8C.dip.t-dialin.net [217.226.251.140]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3XwV8x08kgzbbfK; Tue, 6 Nov 2012 00:14:56 +0100 (CET) From: Anatolij Gustschin To: linux-media@vger.kernel.org Cc: Anatolij Gustschin , Guennadi Liakhovetski Subject: [PATCH] OV5642: fix VIDIOC_S_GROP ioctl Date: Tue, 6 Nov 2012 00:14:50 +0100 Message-Id: <1352157290-13201-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org VIDIOC_S_GROP ioctl doesn't work, soc-camera driver reports: soc-camera-pdrv soc-camera-pdrv.0: S_CROP denied: getting current crop failed The issue is caused by checking for V4L2_BUF_TYPE_VIDEO_CAPTURE type in driver's g_crop callback. This check should be in s_crop instead, g_crop should just set the type field to V4L2_BUF_TYPE_VIDEO_CAPTURE as other drivers do. Move the V4L2_BUF_TYPE_VIDEO_CAPTURE type check to s_crop callback. Signed-off-by: Anatolij Gustschin Cc: Guennadi Liakhovetski --- drivers/media/i2c/soc_camera/ov5642.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c index 8577e0c..19863e5 100644 --- a/drivers/media/i2c/soc_camera/ov5642.c +++ b/drivers/media/i2c/soc_camera/ov5642.c @@ -872,6 +872,9 @@ static int ov5642_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) struct v4l2_rect rect = a->c; int ret; + if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + v4l_bound_align_image(&rect.width, 48, OV5642_MAX_WIDTH, 1, &rect.height, 32, OV5642_MAX_HEIGHT, 1, 0); @@ -899,9 +902,7 @@ static int ov5642_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) struct ov5642 *priv = to_ov5642(client); struct v4l2_rect *rect = &a->c; - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - + a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; *rect = priv->crop_rect; return 0;