From patchwork Fri Sep 14 18:45:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 1460031 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork2.kernel.org (Postfix) with ESMTP id 5A268DF280 for ; Fri, 14 Sep 2012 18:46:10 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8EIk7fb019357 for ; Fri, 14 Sep 2012 13:46:08 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8EIk5pC009299 for ; Fri, 14 Sep 2012 13:46:07 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Fri, 14 Sep 2012 13:46:06 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8EIk6q5009544 for ; Fri, 14 Sep 2012 13:46:06 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 2C9E58062B for ; Fri, 14 Sep 2012 13:46:06 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id C5DE580626 for ; Fri, 14 Sep 2012 13:45:57 -0500 (CDT) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8EIjv7h028143 for ; Fri, 14 Sep 2012 13:45:57 -0500 (CDT) Received: from psmtp.com (na3sys009amx197.postini.com [74.125.149.233]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id q8EIjuSb029259 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 14 Sep 2012 13:45:57 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]) (using TLSv1) by na3sys009amx197.postini.com ([74.125.148.10]) with SMTP; Fri, 14 Sep 2012 11:45:57 PDT Received: by pbbrp12 with SMTP id rp12so6312077pbb.4 for ; Fri, 14 Sep 2012 11:45:56 -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=w7slDownOv3JxvPbZqXf0ppfWiU7SPLC8H4ocl1p6dY=; b=KCWyZG2hxMwwNp0GWxF728u9gU83ZFDJGiU7JspnmmrlShbMbUJdA/H6lxr0gh5eAb kvJr27BcCEbuY5LvYEuZJgTjnQDW175KtkLfXuAK2Xlkm27oF9x/KvaHi6odJ4lDrmB9 yNxHArOSBnofGJq1dP+P+gHd4EKgujiK/917nuEcl5HuPkFEp+4tWaNqNQRC3ZkGtm6G iPqrmmxMub5DfoOJjXtwZADrS/GiwTktaK9zNZox3TDb8m2NkC714lGLQ0wZXoFAckaF Y0XC3hBZXGMif5wLX0DsyFU4yLEjVaD+vfgXiAf6TyLXXEcX8iKY+4iN+fv+KYwR2BJr QKZQ== Received: by 10.68.222.42 with SMTP id qj10mr6144261pbc.117.1347648355731; Fri, 14 Sep 2012 11:45:55 -0700 (PDT) Received: from localhost.localdomain ([112.79.41.31]) by mx.google.com with ESMTPS id pv9sm1381378pbb.67.2012.09.14.11.45.46 (version=SSLv3 cipher=OTHER); Fri, 14 Sep 2012 11:45:53 -0700 (PDT) From: Prabhakar Lad To: LMML Subject: [PATCH v2] davinci: vpif: capture/display: fix race condition Date: Sat, 15 Sep 2012 00:15:25 +0530 Message-ID: <1347648325-5114-1-git-send-email-prabhakar.lad@ti.com> X-Mailer: git-send-email 1.7.0.4 X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:54.55486/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-dkim: 1 skipped:not-enabled X-pstn-settings: 2 (0.5000:0.0050) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [82/3] CC: DLOS , David Oleszkiewicz , LKML , Hans Verkuil , Mauro Carvalho Chehab X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com 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 situations when the isr occurred even before the flag was set due to which it was causing the application 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 --- Changes for v2: 1: Fixed typo's in description. 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; }