From patchwork Fri Sep 14 13:53:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 1458971 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0776F402E1 for ; Fri, 14 Sep 2012 13:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755431Ab2INNyJ (ORCPT ); Fri, 14 Sep 2012 09:54:09 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:45446 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752146Ab2INNyH (ORCPT ); Fri, 14 Sep 2012 09:54:07 -0400 Received: by pbbrr13 with SMTP id rr13so5663868pbb.19 for ; Fri, 14 Sep 2012 06:54:05 -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:x-mailer; bh=a3hJ96bWKLvTUbBF1BWL+Ymg9TkrHuG5ZNviLBhVyco=; b=Pdytq3BIMTXDZQ7sEGAPgl4d/Kf0qQDzxILdpnLnMdFYMgSG19t13vzvNI0hXDvDOd o0glY+ZqzcRRGNwtRwr9nyzxr/kSS6A5FNf1YcfD9YTceCD+/5UefG7ZgtznDPi40G60 lUP3j1nb1Z6YhcN7j2Tv51wZ6tV0Va9yjFKR2WM1kbTQUAL5EMjnYEm8dBt0mbCujq61 tIpXl8XHStN9YvXoINqFgedeD2q3fYqOiP3M9hi7uOEoq7sX2Onui6bJgjSUfbcZZTLH GA0apSGgFXOFenWqZsd0A3M2E0+p5ENEvwQf+ZSuHt3fcz1LQSDgrzWMXJb8EG5WUdiI ByZw== Received: by 10.68.223.3 with SMTP id qq3mr5156813pbc.88.1347630845069; Fri, 14 Sep 2012 06:54:05 -0700 (PDT) Received: from localhost.localdomain ([122.166.13.141]) by mx.google.com with ESMTPS id tt6sm1020328pbc.51.2012.09.14.06.54.01 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Sep 2012 06:54:04 -0700 (PDT) From: Prabhakar Lad To: LMML Cc: LKML , Mauro Carvalho Chehab , DLOS , David Oleszkiewicz , "Lad, Prabhakar" , Manjunath Hadli , Hans Verkuil Subject: [PATCH] davinci: vpif: capture/display: fix race condition Date: Fri, 14 Sep 2012 19:23:56 +0530 Message-Id: <1347630836-7545-1-git-send-email-prabhakar.lad@ti.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Lad, Prabhakar channel_first_int[][] variable is used as a flag for the ISR, This flag was being set after enabling the interrupts, There where suitaions when the isr ocuurend even before the flag was set dues to which it was causing the applicaiotn hang. This patch sets channel_first_int[][] flag just before enabling the interrupt. Reported-by: David Oleszkiewicz Signed-off-by: Lad, Prabhakar Signed-off-by: Manjunath Hadli Cc: Hans Verkuil --- drivers/media/platform/davinci/vpif_capture.c | 2 +- drivers/media/platform/davinci/vpif_display.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 1b625b0..f64919b 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -339,6 +339,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) * Set interrupt for both the fields in VPIF Register enable channel in * VPIF register */ + channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; if ((VPIF_CHANNEL0_VIDEO == ch->channel_id)) { channel0_intr_assert(); channel0_intr_enable(1); @@ -350,7 +351,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) channel1_intr_enable(1); enable_channel1(1); } - channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; return 0; } diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 4a24848..523a840 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -302,6 +302,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) /* Set interrupt for both the fields in VPIF Register enable channel in VPIF register */ + channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; if (VPIF_CHANNEL2_VIDEO == ch->channel_id) { channel2_intr_assert(); channel2_intr_enable(1); @@ -318,7 +319,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) if (vpif_config_data->ch3_clip_en) channel3_clipping_enable(1); } - channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; return 0; }