From patchwork Thu Oct 29 10:10:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 7517981 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 075899F37F for ; Thu, 29 Oct 2015 10:11:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CB0920644 for ; Thu, 29 Oct 2015 10:11:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40A682068D for ; Thu, 29 Oct 2015 10:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756735AbbJ2KKq (ORCPT ); Thu, 29 Oct 2015 06:10:46 -0400 Received: from mail-lf0-f46.google.com ([209.85.215.46]:35410 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756638AbbJ2KKo (ORCPT ); Thu, 29 Oct 2015 06:10:44 -0400 Received: by lfbn126 with SMTP id n126so16112917lfb.2; Thu, 29 Oct 2015 03:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6i4XblWLa24nAUxbs8ofYtdSk+EfQca3aWR6iueimIs=; b=fvIxpm1/zFISLP2DZkm6FBnzegaFxgzu07pJ66hqmJrPmNMJcguu20PXiqOsBe3F0x N38dSYf+1VapO2GO9fqH/5zFnqSR0s+NganBXJ+LVwd8yugNuEgJLmHBU3ZbmV0yuVQG cnoF5d2Ee4xfvD5M8p13O2wfnAGmUDp8kugpP+douAnRx8zy9NCcw5oJhREfnCo79VPj YNHqTk2pbJIqWfSPWXC9xrEDZ9icFMxxSr9P/Yj2dnHYUnXN7zZNrSR9pgkqBsYngRmC g8qUzxM4RSvIP1qsD6sRC1N/L/QxlrN4cBJjGqOgPIeCHhk24Rb9sAHNwO3KvQu3ACaw SBWQ== X-Received: by 10.25.83.139 with SMTP id h133mr316565lfb.89.1446113443241; Thu, 29 Oct 2015 03:10:43 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id r77sm164022lfr.30.2015.10.29.03.10.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 03:10:42 -0700 (PDT) From: Ricardo Ribalda Delgado To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans Verkuil , Steven Toth , Sakari Ailus , Vincent Palatin , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH v2 5/6] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL Date: Thu, 29 Oct 2015 11:10:31 +0100 Message-Id: <1446113432-27390-6-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1446113432-27390-1-git-send-email-ricardo.ribalda@gmail.com> References: <1446113432-27390-1-git-send-email-ricardo.ribalda@gmail.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=-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 This driver does not use the control infrastructure. Add support for the new field which on structure v4l2_ext_controls Acked-by: Mike Isely Signed-off-by: Ricardo Ribalda Delgado --- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 1c5f85bf7ed4..81f788b7b242 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -628,6 +628,7 @@ static int pvr2_g_ext_ctrls(struct file *file, void *priv, struct pvr2_v4l2_fh *fh = file->private_data; struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; struct v4l2_ext_control *ctrl; + struct pvr2_ctrl *cptr; unsigned int idx; int val; int ret; @@ -635,8 +636,15 @@ static int pvr2_g_ext_ctrls(struct file *file, void *priv, ret = 0; for (idx = 0; idx < ctls->count; idx++) { ctrl = ctls->controls + idx; - ret = pvr2_ctrl_get_value( - pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id), &val); + cptr = pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id); + if (cptr) { + if (ctls->which == V4L2_CTRL_WHICH_DEF_VAL) + pvr2_ctrl_get_def(cptr, &val); + else + ret = pvr2_ctrl_get_value(cptr, &val); + } else + ret = -EINVAL; + if (ret) { ctls->error_idx = idx; return ret; @@ -658,6 +666,10 @@ static int pvr2_s_ext_ctrls(struct file *file, void *priv, unsigned int idx; int ret; + /* Default value cannot be changed */ + if (ctls->which == V4L2_CTRL_WHICH_DEF_VAL) + return -EINVAL; + ret = 0; for (idx = 0; idx < ctls->count; idx++) { ctrl = ctls->controls + idx;