From patchwork Sun Jun 1 03:39:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 4277191 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ECF299F1D6 for ; Sun, 1 Jun 2014 03:39:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 28B90202E6 for ; Sun, 1 Jun 2014 03:39:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 570C1202E5 for ; Sun, 1 Jun 2014 03:39:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751566AbaFADja (ORCPT ); Sat, 31 May 2014 23:39:30 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:59654 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756200AbaFADj1 (ORCPT ); Sat, 31 May 2014 23:39:27 -0400 Received: from avalon.ideasonboard.com (8.26-200-80.adsl-dyn.isp.belgacom.be [80.200.26.8]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CA66635A67; Sun, 1 Jun 2014 05:39:01 +0200 (CEST) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH 09/18] v4l: vsp1: sru: Fix the intensity control default value Date: Sun, 1 Jun 2014 05:39:28 +0200 Message-Id: <1401593977-30660-10-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1401593977-30660-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1401593977-30660-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 The default value isn't set and defaults to 0, which isn't in the 1-6 min-max range. Fix it by setting the default value to 1. This shoud have been caught when checking the control handler error field at initialization time, but the check was missing. Add it. Signed-off-by: Laurent Pinchart --- drivers/media/platform/vsp1/vsp1_sru.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c index aa0e04c..18e127a 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.c +++ b/drivers/media/platform/vsp1/vsp1_sru.c @@ -67,6 +67,7 @@ static const struct v4l2_ctrl_config sru_intensity_control = { .type = V4L2_CTRL_TYPE_INTEGER, .min = 1, .max = 6, + .def = 1, .step = 1, }; @@ -348,8 +349,17 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1) /* Initialize the control handler. */ v4l2_ctrl_handler_init(&sru->ctrls, 1); v4l2_ctrl_new_custom(&sru->ctrls, &sru_intensity_control, NULL); - v4l2_ctrl_handler_setup(&sru->ctrls); + sru->entity.subdev.ctrl_handler = &sru->ctrls; + if (sru->ctrls.error) { + dev_err(vsp1->dev, "sru: failed to initialize controls\n"); + ret = sru->ctrls.error; + vsp1_entity_destroy(&sru->entity); + return ERR_PTR(ret); + } + + v4l2_ctrl_handler_setup(&sru->ctrls); + return sru; }