From patchwork Tue Feb 17 11:02:14 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: 5838351 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8D2FFBF440 for ; Tue, 17 Feb 2015 11:02:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5F102012B for ; Tue, 17 Feb 2015 11:02:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFBB420155 for ; Tue, 17 Feb 2015 11:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754955AbbBQLCV (ORCPT ); Tue, 17 Feb 2015 06:02:21 -0500 Received: from mail-la0-f52.google.com ([209.85.215.52]:42770 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752089AbbBQLCT (ORCPT ); Tue, 17 Feb 2015 06:02:19 -0500 Received: by labgf13 with SMTP id gf13so34982443lab.9; Tue, 17 Feb 2015 03:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=whtNGq/65/I2WViN7nP0WauJoQI0uhBBPA6F7sR8vmw=; b=H+3th4oi/RNvcaqjg9l0SkIzfVhL51zHL7l/HrwNXiFJTg8dpBEgsQTumCceFf/RAw CU+UXBpaevI6XY02C/5egHC06AcInvTh3wNwbx4Vr9A3TZ1QtASEWa6mVfuHRnrtKI8A 6wCZCRVrY2XzijnZ8AIUeLeVYjMUS8G4FII3sbDCVnAnhKBMqcNt2dG6PqjJjOpd4YqR mL+f09HZtg1egFTB1CQveaY9l+DisKLfrRBjMaZcn+wQoaOsEeIpiN3v8TN5+CF7mb8p L83LSD87hJkvCaPRNO3ZDXNvtHE8ccMHXX1taIMroKw7QFKpu6TF8HzX0nmImZ1kmucr n7tQ== X-Received: by 10.112.13.38 with SMTP id e6mr28310929lbc.31.1424170938160; Tue, 17 Feb 2015 03:02:18 -0800 (PST) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by mx.google.com with ESMTPSA id rm3sm3491080lbb.47.2015.02.17.03.02.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Feb 2015 03:02:17 -0800 (PST) From: Ricardo Ribalda Delgado To: Hans Verkuil , Mauro Carvalho Chehab , Sylwester Nawrocki , Antti Palosaari , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH] media/v4l2-ctrls: Always run s_ctrl on volatile ctrls Date: Tue, 17 Feb 2015 12:02:14 +0100 Message-Id: <1424170934-18619-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.1.4 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, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Volatile controls can change their value outside the v4l-ctrl framework. We should ignore the cached written value of the ctrl when evaluating if we should run s_ctrl. Signed-off-by: Ricardo Ribalda Delgado --- I have a control that tells the user when there has been a external trigger overrun. (Trigger while processing old image). This is a volatile control. The user writes 0 to the control, to ack the error condition, and clear the hardware flag. Unfortunately, it only works one time, because the next time the user writes a zero to the control cluster_changed returns false. I think on volatile controls it is safer to run s_ctrl twice than missing a valid s_ctrl. I know I am abusing a bit the API for this :P, but I also believe that the semantic here is a bit confusing. drivers/media/v4l2-core/v4l2-ctrls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 45c5b47..3d0c7f4 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1605,7 +1605,7 @@ static int cluster_changed(struct v4l2_ctrl *master) for (i = 0; i < master->ncontrols; i++) { struct v4l2_ctrl *ctrl = master->cluster[i]; - bool ctrl_changed = false; + bool ctrl_changed = ctrl->flags & V4L2_CTRL_FLAG_VOLATILE; if (ctrl == NULL) continue;