From patchwork Tue Feb 17 12:21:21 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: 5839591 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 DE42D9F30C for ; Tue, 17 Feb 2015 12:21:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 241402018E for ; Tue, 17 Feb 2015 12:21:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B24520125 for ; Tue, 17 Feb 2015 12:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbbBQMV2 (ORCPT ); Tue, 17 Feb 2015 07:21:28 -0500 Received: from mail-la0-f50.google.com ([209.85.215.50]:44103 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752830AbbBQMVZ (ORCPT ); Tue, 17 Feb 2015 07:21:25 -0500 Received: by lams18 with SMTP id s18so35405182lam.11; Tue, 17 Feb 2015 04:21:24 -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=iF5SiXzS94lXWqFyfCrEAuTFVY+xNVp6JBfK9pVvKAA=; b=yC8EHqPuWUzzOKU7C7kY7K9rqqPSGLOZo4jX8pwYzj3szzYJ9zDuRhqfrnUbmjCKFo +am+as3tYZeAE29UrLfuxahupdV+5pRfB7519dMimDfvUuDejLGL/sLwBLm68O2+RwAq oR75aaj2ZbeLIWL1T2XaRyFk66ZRRQj9U92GNxOklEkngXEEqX+uI0qw5ybCgTKccAEB jhCgwq3OsQ0q0J2S8Fgmo1NBoX3RnY1lOFEDAMCKmXSXHISJlQaWjGfCXleEn0cDv4JF xfAu2pjxAlT8Ayo4nNwbiusn123CqGOZd1t7ZexPoys6fHGg5MB0N8U1MRYZzruJn1U4 ll4g== X-Received: by 10.112.26.110 with SMTP id k14mr27902193lbg.29.1424175683959; Tue, 17 Feb 2015 04:21:23 -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 ba3sm3535680lbc.35.2015.02.17.04.21.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Feb 2015 04:21:22 -0800 (PST) From: Ricardo Ribalda Delgado To: Hans Verkuil , 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 v2] media/v4l2-ctrls: Always run s_ctrl on volatile ctrls Date: Tue, 17 Feb 2015 13:21:21 +0100 Message-Id: <1424175681-19787-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=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 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 Acked-by: Sakari Ailus --- v2: Do volatile test, once you know ctrl is not NULL drivers/media/v4l2-core/v4l2-ctrls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 45c5b47..f0f58dd 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1605,10 +1605,13 @@ 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; if (ctrl == NULL) continue; + + ctrl_changed = ctrl->flags & V4L2_CTRL_FLAG_VOLATILE; + for (idx = 0; !ctrl_changed && idx < ctrl->elems; idx++) ctrl_changed = !ctrl->type_ops->equal(ctrl, idx, ctrl->p_cur, ctrl->p_new);