From patchwork Thu Jul 18 13:01:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 2829641 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 5E45B9F9CF for ; Thu, 18 Jul 2013 13:01:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8FED9201BB for ; Thu, 18 Jul 2013 13:01:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D637201B6 for ; Thu, 18 Jul 2013 13:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758241Ab3GRNB0 (ORCPT ); Thu, 18 Jul 2013 09:01:26 -0400 Received: from mail.free-electrons.com ([94.23.35.102]:56951 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758179Ab3GRNBZ (ORCPT ); Thu, 18 Jul 2013 09:01:25 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id 1CD657DE; Thu, 18 Jul 2013 15:01:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost.localdomain (unknown [190.2.109.25]) by mail.free-electrons.com (Postfix) with ESMTPA id 5034D76C; Thu, 18 Jul 2013 15:01:23 +0200 (CEST) From: Ezequiel Garcia To: Cc: Ezequiel Garcia , Sergey 'Jin' Bostandzhyan , Hans Verkuil Subject: [PATCH] media: stk1160: Ignore unchanged standard set Date: Thu, 18 Jul 2013 10:01:23 -0300 Message-Id: <1374152483-3106-1-git-send-email-ezequiel.garcia@free-electrons.com> X-Mailer: git-send-email 1.8.1.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This commit adds an early check to vidioc_s_std() to detect if the new and current standards are equal, and exit with success in that case. This is needed to prevent userspace applications that might attempt to re-set the same standard from failing if that's done when streaming has started. Signed-off-by: Ezequiel Garcia --- Cc: Sergey 'Jin' Bostandzhyan Cc: Hans Verkuil drivers/media/usb/stk1160/stk1160-v4l.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c index ee46d82..c45c988 100644 --- a/drivers/media/usb/stk1160/stk1160-v4l.c +++ b/drivers/media/usb/stk1160/stk1160-v4l.c @@ -379,6 +379,9 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) struct stk1160 *dev = video_drvdata(file); struct vb2_queue *q = &dev->vb_vidq; + if (dev->norm == norm) + return 0; + if (vb2_is_busy(q)) return -EBUSY;