From patchwork Mon Oct 19 14:07:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 7437331 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5B6A49F302 for ; Mon, 19 Oct 2015 14:08:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 739F82067D for ; Mon, 19 Oct 2015 14:08:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0CB02068A for ; Mon, 19 Oct 2015 14:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752992AbbJSOH7 (ORCPT ); Mon, 19 Oct 2015 10:07:59 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:35719 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752969AbbJSOH6 (ORCPT ); Mon, 19 Oct 2015 10:07:58 -0400 Received: by wicll6 with SMTP id ll6so7558248wic.0 for ; Mon, 19 Oct 2015 07:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jSEnj/+CiJ0IymxLHWmw1jZymPV5bW8PhhhFax44YNs=; b=FLmFZ4Eazqi5lIhtKE7H31lGDA24lsCsk9qd64Kmfgy91R4LYsPlKRNPdQtes2kTyf a7T/qSG2Hk5hGzrxRNTPlcK1Pky4F4lo9ZvIZgOjAayMAlPIJsop6JAXzpgJo+nzRqcN lDp1ReYAZvFkqxgPDnsydHmbYhzO8dXwFixLs5H+CecL8bPqe5SSV7yKaGExsZNqKngh hUBJ7Ge4mTEoiodUhhtMsrXk7N4bOZJBw2hP9/gDmLblH99JIWE4ilG2iRBJHQ9ReZHa HVlahKaXKGt9SD9NzP4BwIGNTpVoXx7ScF2CWmP2+JLLSkvUKP6sj6ShHQlILDdeV14S 0UUw== X-Received: by 10.180.93.2 with SMTP id cq2mr17085697wib.33.1445263677792; Mon, 19 Oct 2015 07:07:57 -0700 (PDT) Received: from groucho.site (ipbcc0ddf2.dynamic.kabel-deutschland.de. [188.192.221.242]) by smtp.gmail.com with ESMTPSA id q8sm3241169wiz.23.2015.10.19.07.07.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Oct 2015 07:07:57 -0700 (PDT) From: Ulrich Hecht To: linux-sh@vger.kernel.org Cc: magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com, william.towle@codethink.co.uk, rob.taylor@codethink.co.uk, hans.verkuil@cisco.com, ian.molton@codethink.co.uk Subject: [PATCH/RFT 3/7] media: rcar_vin: Use correct pad number in try_fmt Date: Mon, 19 Oct 2015 16:07:36 +0200 Message-Id: <1445263660-6945-4-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1445263660-6945-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1445263660-6945-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: William Towle Fix rcar_vin_try_fmt's use of an inappropriate pad number when calling the subdev set_fmt function - for the ADV7612, IDs should be non-zero. Signed-off-by: William Towle Reviewed-by: Rob Taylor Acked-by: Hans Verkuil --- drivers/media/platform/soc_camera/rcar_vin.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c index 43615c1..f4e611b 100644 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c @@ -1700,7 +1700,7 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd, const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct v4l2_subdev_pad_config pad_cfg; + struct v4l2_subdev_pad_config *pad_cfg; struct v4l2_subdev_format format = { .which = V4L2_SUBDEV_FORMAT_TRY, }; @@ -1709,6 +1709,10 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd, int width, height; int ret; + pad_cfg = v4l2_subdev_alloc_pad_config(sd); + if (pad_cfg == NULL) + return -ENOMEM; + xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); if (!xlate) { xlate = icd->current_fmt; @@ -1737,10 +1741,11 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd, mf->code = xlate->code; mf->colorspace = pix->colorspace; + format.pad = icd->src_pad_idx; ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd), - pad, set_fmt, &pad_cfg, &format); + pad, set_fmt, pad_cfg, &format); if (ret < 0) - return ret; + goto cleanup; /* Adjust only if VIN cannot scale */ if (pix->width > mf->width * 2) @@ -1764,12 +1769,12 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd, mf->height = VIN_MAX_HEIGHT; ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd), - pad, set_fmt, &pad_cfg, + pad, set_fmt, pad_cfg, &format); if (ret < 0) { dev_err(icd->parent, "client try_fmt() = %d\n", ret); - return ret; + goto cleanup; } } /* We will scale exactly */ @@ -1779,6 +1784,8 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd, pix->height = height; } +cleanup: + v4l2_subdev_free_pad_config(pad_cfg); return ret; }