From patchwork Thu Feb 7 00:03:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Sheu X-Patchwork-Id: 2109041 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 42BDBDF2A1 for ; Thu, 7 Feb 2013 00:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758091Ab3BGADk (ORCPT ); Wed, 6 Feb 2013 19:03:40 -0500 Received: from mail-ob0-f201.google.com ([209.85.214.201]:60603 "EHLO mail-ob0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757465Ab3BGADj (ORCPT ); Wed, 6 Feb 2013 19:03:39 -0500 Received: by mail-ob0-f201.google.com with SMTP id un3so387720obb.4 for ; Wed, 06 Feb 2013 16:03:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=mn4YEu9qraXMUF+XLrLE69kegO88RwlNAjViDrdRSjs=; b=iZNE1RMVkb5zruTO0ApybTa47+KvkNFvT+Sh+dQSuXo3USbGrdYXKnPAZbk5R3U60k P8pwm+KqfjoFI3DsLEgTUIKTlUZfJEZa6ZAWlaRcdC1lPAq0Uu116UWPzkjOMHOeCExt KMAfKWEpMPG46V5Yw0OdCl3LuG7lRzmjZd9r1L3qpye5zYYQlj9O2c8+MWZOs4DZVlNP trTv4S+b/vVtBXsukO4l+Mm44RuJl0HkmVF+H9Q+CiSxTYlWv5hf57qmvfCk9jPc4BAi qQbHH/hNMGmzCRMnR8e/3Kmg89sp2akzD8gEQF+v+Bo+X+6Nlj8AIOngpL/NHhNvMrfK Qa8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=mn4YEu9qraXMUF+XLrLE69kegO88RwlNAjViDrdRSjs=; b=IpuOVkGGIbKhKOhDuFLdsTf3MbEAsV4BfcLshz7mRN7zKQFxg4mc99NIq3ebcADuK6 pTWaXgL1gazfgGOb8H1D/Wfluu+rK5BAlTbMxeqEhy9O4vt1Zg4LqIeSplLmVMWQ+mY2 ktmhB55f8CsJiBwfsL32hDPltJY9OHwUPneyNkI4NlU4o/+/NMcW6xmFQ4k8Nc6nPfgR 6MwgwIJC4/rq7VgG1x6j9kzF1jgKGFJa4t+ocgTyR/BFqe2M78OSKHopViRsYG8menHL A+bBpXp9rqNP4OT6QUO2sF6faUGNgt5WSRxcmtCXybK/wNU5SqUBZ964qxOnT5jf9IuS wPYw== X-Received: by 10.50.153.229 with SMTP id vj5mr4079577igb.7.1360195419077; Wed, 06 Feb 2013 16:03:39 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id dx8si358193igc.1.2013.02.06.16.03.38 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 06 Feb 2013 16:03:39 -0800 (PST) Received: from shortskirt.mtv.corp.google.com (shortskirt.mtv.corp.google.com [172.22.70.255]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 84A2B31C1F1; Wed, 6 Feb 2013 16:03:38 -0800 (PST) Received: by shortskirt.mtv.corp.google.com (Postfix, from userid 157237) id 0298AC04E6; Wed, 6 Feb 2013 16:03:37 -0800 (PST) From: John Sheu To: linux-media@vger.kernel.org Cc: John Sheu , John Sheu Subject: [PATCH 1/3] [media] v4l2-mem2mem: use CAPTURE queue lock Date: Wed, 6 Feb 2013 16:03:00 -0800 Message-Id: <1360195382-32317-1-git-send-email-sheu@google.com> X-Mailer: git-send-email 1.8.1 X-Gm-Message-State: ALoCoQkcFEdrATcExfIBaJpUqLEfgMe+1Uxb5nKpmpBf6lo4rfSpMLxqsWd8aqONpO4jahZWeo75W4DdN+ysgAYIG3ftd4Fr6GD48C7BOmj5TZvFt+ppzr4JQ3wnG5L/OxTQaAV2oW5k4ixMbSg8srUJ+A/lwdUrNeMnie1wE0MJMx3mMcIwjZDNzj25RT+VZoOut7p6U0WPI8VOvMXgtUUOhv5AsCSs7A== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: John Sheu In v4l2_m2m_try_schedule(), use the CAPTURE queue lock when accessing the CAPTURE queue, instead of relying on just holding the OUTPUT queue lock. Signed-off-by: John Sheu Acked-by: Pawel Osciak --- drivers/media/v4l2-core/v4l2-mem2mem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 438ea45..c52a2c5 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -230,12 +230,15 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) dprintk("No input buffers available\n"); return; } + spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)) { + spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); dprintk("No output buffers available\n"); return; } + spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); if (m2m_dev->m2m_ops->job_ready