From patchwork Sat Sep 6 15:26:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 4857661 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 6A68B9F32F for ; Sat, 6 Sep 2014 15:28:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FD4720138 for ; Sat, 6 Sep 2014 15:28:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDF8D2012F for ; Sat, 6 Sep 2014 15:28:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752007AbaIFP2Y (ORCPT ); Sat, 6 Sep 2014 11:28:24 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:58517 "EHLO mail-we0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751793AbaIFP1q (ORCPT ); Sat, 6 Sep 2014 11:27:46 -0400 Received: by mail-we0-f173.google.com with SMTP id t60so12997232wes.4 for ; Sat, 06 Sep 2014 08:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CUWBmRCCs+iMPEkupLacFDVEBICgmFKqsijxuTnViRE=; b=x5f9CRSly0QyP0tBFaZP2XRcmf7uSyhkJDi4wx+a7UwsZE2MuuTVOWdNF5KqcNROUM bkka/hRMUwHcVB3RsgR/qKdxXpuVVoiyYLJWpphse6aBB7lehnR7baLwvVYrJKbmXgzf V0ROPD8wXWK/KZOmfo7IVf9th7EZQ7m1yqoeVQwsLn9s6RmzxgXV0wpVzdqEVgoxV44u JcwnCz3P6xxqIvV7H5WTcyhhT9DEBo1kTrmUp4pAklTsVr1JnUWtP5b7Lm6ANLXB26qr aGjnzQ7U1mJMq7wY0xLJeSTyGCNtCDUlYP7+AwOWc1BD4qI8N8IZY6m7Gc0mk6y3ZVQy ZWWg== X-Received: by 10.180.184.20 with SMTP id eq20mr10430169wic.61.1410017265422; Sat, 06 Sep 2014 08:27:45 -0700 (PDT) Received: from tango-charlie.Home ([2.127.193.40]) by mx.google.com with ESMTPSA id bg10sm4831620wjc.47.2014.09.06.08.27.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Sep 2014 08:27:44 -0700 (PDT) From: "Lad, Prabhakar" To: LMML Cc: LKML , DLOS , Mauro Carvalho Chehab , Hans Verkuil , "Lad, Prabhakar" Subject: [PATCH 5/5] media: davinci: vpif_capture: fix the check on suspend/resume callbacks Date: Sat, 6 Sep 2014 16:26:51 +0100 Message-Id: <1410017211-15438-6-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410017211-15438-1-git-send-email-prabhakar.csengg@gmail.com> References: <1410017211-15438-1-git-send-email-prabhakar.csengg@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 It is possible to call STREAMON without having any buffers queued. So vb2_is_streaming() can return true without start_streaming() having been called. Only after at least one buffer has been queued will start_streaming be called. The check vb2_is_streaming() is incorrect as this would start the DMA without having proper DMA pointers set up. this patch uses vb2_start_streaming_called() instead to check is streaming was called. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpif_capture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 881efcd..3ccb26f 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1596,7 +1596,7 @@ static int vpif_suspend(struct device *dev) ch = vpif_obj.dev[i]; common = &ch->common[VPIF_VIDEO_INDEX]; - if (!vb2_is_streaming(&common->buffer_queue)) + if (!vb2_start_streaming_called(&common->buffer_queue)) continue; mutex_lock(&common->lock); @@ -1630,7 +1630,7 @@ static int vpif_resume(struct device *dev) ch = vpif_obj.dev[i]; common = &ch->common[VPIF_VIDEO_INDEX]; - if (!vb2_is_streaming(&common->buffer_queue)) + if (!vb2_start_streaming_called(&common->buffer_queue)) continue; mutex_lock(&common->lock);