From patchwork Sat Mar 14 02:18:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 6010501 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 DC40D9F54E for ; Sat, 14 Mar 2015 02:19:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 124E7202E5 for ; Sat, 14 Mar 2015 02:19:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13089202D1 for ; Sat, 14 Mar 2015 02:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753746AbbCNCS4 (ORCPT ); Fri, 13 Mar 2015 22:18:56 -0400 Received: from resqmta-po-08v.sys.comcast.net ([96.114.154.167]:47050 "EHLO resqmta-po-08v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751188AbbCNCS4 (ORCPT ); Fri, 13 Mar 2015 22:18:56 -0400 Received: from resomta-po-06v.sys.comcast.net ([96.114.154.230]) by resqmta-po-08v.sys.comcast.net with comcast id 3EJN1q0044yXVJQ01EJvbU; Sat, 14 Mar 2015 02:18:55 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-06v.sys.comcast.net with comcast id 3EJu1q0061LXgTt01EJuuF; Sat, 14 Mar 2015 02:18:55 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 2053240D83; Fri, 13 Mar 2015 20:18:54 -0600 (MDT) From: Shuah Khan To: hans.verkuil@cisco.com, prabhakar.csengg@gmail.com, Julia.Lawall@lip6.fr, laurent.pinchart@ideasonboard.com Cc: Shuah Khan , linux-media@vger.kernel.org Subject: [PATCH] media: au0828 - add vidq busy checks to s_std and s_input Date: Fri, 13 Mar 2015 20:18:43 -0600 Message-Id: <1426299523-14718-1-git-send-email-shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1426299535; bh=FuqV70GhHQPSltZmm03fA6ROFLvjlW4vCMGnJwvCZa4=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=toGc93DxpnrR6pFiO0x9JGMgdZ4ao8G3XR5fG+JE2OAlK+GV90Aa8z744NbWxWHik 85mPp8utJp5ufcNbsh9p02YN/xirrXAC/394AhpZ3cXHSXKqkdD2ZXh5rtoc3CxCuH rYDlseejzBN6zQOxF932P1Qf/j/4tUKGDuwVbOYUhPoWS208zSBlqw7PpRkYnJW5QV 9axohR1VuTQJTtT/z9zG7sb0K3/WApP80qIsN+vjl/kRkNhIrPQeW+RUepo5sXSg37 fcLVBNyRjysn6O7CUCTFiZQ4HDDY0ybFOmQ9xHOTPloJucW54KnL/HI5b0Ptt9ETxl L9hpyG3os3kTg== 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_SIGNED, 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 au0828 s_std and s_input are missing queue busy checks. Add vb2_is_busy() calls to s_std and s_input and return -EBUSY if found busy. Signed-off-by: Shuah Khan --- drivers/media/usb/au0828/au0828-video.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index f47ee90..42c49c2 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -1214,6 +1214,11 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) if (norm == dev->std) return 0; + if (vb2_is_busy(&dev->vb_vidq)) { + pr_info("%s queue busy\n", __func__); + return -EBUSY; + } + if (dev->streaming_users > 0) return -EBUSY; @@ -1364,6 +1369,14 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) return -EINVAL; if (AUVI_INPUT(index).type == 0) return -EINVAL; + /* + * Changing the input implies a format change, which is not allowed + * while buffers for use with streaming have already been allocated. + */ + if (vb2_is_busy(&dev->vb_vidq)) { + pr_info("%s queue busy\n", __func__); + return -EBUSY; + } dev->ctrl_input = index; au0828_s_input(dev, index); return 0;