From patchwork Fri May 24 00:41:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Sheu X-Patchwork-Id: 2609361 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 3B04ADFB78 for ; Fri, 24 May 2013 00:42:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758065Ab3EXAmM (ORCPT ); Thu, 23 May 2013 20:42:12 -0400 Received: from mail-ye0-f201.google.com ([209.85.213.201]:40359 "EHLO mail-ye0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757810Ab3EXAmL (ORCPT ); Thu, 23 May 2013 20:42:11 -0400 Received: by mail-ye0-f201.google.com with SMTP id q9so106781yen.4 for ; Thu, 23 May 2013 17:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=TSF61+gVNLB+s8SmcShwU+gs7Wlu6ov+2TYAyit4U+o=; b=HsEhlNG3LYCFtRzJsBImzR++ChGMiKUz/gwj8w1eNNRmHolzbDiytFH1dHn+gD3fmT /3o+XsH1E1imrtM2jF+v9t6C2wQzUSUp5x6rG7inbG/LOTHeryiPUho8s6tIiVABhqDG XEgYhb2a5L6G8Jh25X0faeC06ib8JW69e+bojqGgQ9tC4YbewUTC0u3n1ysaPh5CO/Om gLnqG5ZtdlRqZl59SbyaE9xy8SMczlrJo6l+Xrny2X7nKPqWMV0BPVZwKxCEfV7eD0UT OAP5W1QF73O9IcuG2mtkqHg0q9uMRvfRADSVsEFGzR5KEmoQZa2vL3Zr3k/Jrk3ZhwGP kQLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=TSF61+gVNLB+s8SmcShwU+gs7Wlu6ov+2TYAyit4U+o=; b=QOjdX5x6/Rv4zZFS6vDTCAehkmw0gnZySDLJVwh21e0r5MeFHtBsypHBzU2h9cumLz z3euTtUCzZiT0C87XBtKHhpG+4j5v10+NxEh/hcxHpuY70DmN6kmsNJk1WYRigzTph// 1d+orGzQNfy6foIOcZFUM+jpekekX/Qz/+VG5hIj42fu70JRKtXyyRX/dXh8rZsYAeYX OT6xg52sL1WEBlXNfuv7FDij2F7ODlQlUqhzO7GH506W9hrNOFdHDo9WRiovtWrvfXgX ehqYdshSD37YJpShuCvh1XfOOFH4+VOMn9pPyqN7aFMJn0yr+0F1iAgnCAZ7VKYoYRUX HCaQ== X-Received: by 10.236.118.44 with SMTP id k32mr1698057yhh.24.1369356130705; Thu, 23 May 2013 17:42:10 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id u47si1195952yhe.0.2013.05.23.17.42.10 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Thu, 23 May 2013 17:42:10 -0700 (PDT) Received: from shortskirt.mtv.corp.google.com (shortskirt.mtv.corp.google.com [172.22.70.255]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 88B995A4173; Thu, 23 May 2013 17:42:10 -0700 (PDT) Received: by shortskirt.mtv.corp.google.com (Postfix, from userid 157237) id 13DC3C074D; Thu, 23 May 2013 17:42:09 -0700 (PDT) From: John Sheu To: linux-media@vger.kernel.org Cc: mchehab@redhat.com, pawel@osciak.com, John Sheu Subject: [PATCH] [media] v4l2: mem2mem: save irq flags correctly Date: Thu, 23 May 2013 17:41:48 -0700 Message-Id: <1369356108-15865-1-git-send-email-sheu@google.com> X-Mailer: git-send-email 1.8.2.1 X-Gm-Message-State: ALoCoQmr9nOw374/FD+O/SvEvwu1UXxCKYaUgE1RMP9Ms2Tia7TZiyFWKy6/2qFuAG37H4+lgvqvDgQx5pQYBk/DKFEr/cMNsx2fsiYQmyNOXmGiip9SQx1V7MKr18M2j2tBeVXeMKPTYi1R+tFQAkXGy+Sy96lAdzu+fDNxzCTXfqiXzk/6L9Odv7m0dC9a4u9oJYZkIt393m178PnJaG09MgEB0ah5Pw== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Save flags correctly when taking spinlocks in v4l2_m2m_try_schedule. Signed-off-by: John Sheu Acked-by: Pawel Osciak --- drivers/media/v4l2-core/v4l2-mem2mem.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 66f599f..3606ff2 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -205,7 +205,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev) static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) { struct v4l2_m2m_dev *m2m_dev; - unsigned long flags_job, flags; + unsigned long flags_job, flags_out, flags_cap; m2m_dev = m2m_ctx->m2m_dev; dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx); @@ -223,23 +223,26 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) return; } - spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); + spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out); if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)) { - spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); + spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, + flags_out); spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); dprintk("No input buffers available\n"); return; } - spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); + spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap); 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_ctx->cap_q_ctx.rdy_spinlock, + flags_cap); + spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, + flags_out); 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); + spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap); + spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out); if (m2m_dev->m2m_ops->job_ready && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) {