From patchwork Thu Jan 2 12:07:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 3424791 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 42FE69F381 for ; Thu, 2 Jan 2014 12:15:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E43520148 for ; Thu, 2 Jan 2014 12:15:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82E4F20145 for ; Thu, 2 Jan 2014 12:15:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751733AbaABMIL (ORCPT ); Thu, 2 Jan 2014 07:08:11 -0500 Received: from moutng.kundenserver.de ([212.227.17.9]:61645 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751061AbaABMIK (ORCPT ); Thu, 2 Jan 2014 07:08:10 -0500 Received: from wuerfel.lan (HSI-KBW-085-216-031-165.hsi.kabelbw.de [85.216.31.165]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0M5rAH-1VEHaX3Qy1-00yJ91; Thu, 02 Jan 2014 13:08:04 +0100 From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH, RFC 05/30] [media] omap_vout: avoid sleep_on race Date: Thu, 2 Jan 2014 13:07:29 +0100 Message-Id: <1388664474-1710039-6-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1388664474-1710039-1-git-send-email-arnd@arndb.de> References: <1388664474-1710039-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:nKJiOIFltRHci2ICBJ6fs16+lbCLX+fET5irTXwn+i5 xtWqMedH+tPeqqx9vtcEjs+UZEMO7twf6KgoISI4PgWV43wwGt 1RmQf5OtjdiS/rPlXghfg65b9h8kIrEvbqPoNKNsO5tXWIx2XB aY4rGVuUpGjkzkAnfzQGEfFHFx4oB37JOL+plERJ55UaRf6D8J vqTQb3Lj/VK+MT6/Ue26R5813XHUNSvfxAHMrWGwTRGw8PsaTp nyz1FAhUNtq6S6mWuHHUTQWa7K0+HqwxH7a5XsPnzMbYRdWELo P9eC+7GwLLbBCNxXVCNYIYynjrrvxqO8i5ly3XdIe/UdFUBn3P 3Ogj6BBi1flba6Sn9QGgIAcl2Fx4oZd1ALw7pEgJP Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 sleep_on and its variants are broken and going away soon. This changes the omap vout driver to use interruptible_sleep_on_timeout instead, which fixes potential race where the dma is complete before we schedule. Signed-off-by: Arnd Bergmann Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Reviewed-by: Hans Verkuil --- drivers/media/platform/omap/omap_vout_vrfb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c index cf1c437..62e7e57 100644 --- a/drivers/media/platform/omap/omap_vout_vrfb.c +++ b/drivers/media/platform/omap/omap_vout_vrfb.c @@ -270,7 +270,8 @@ int omap_vout_prepare_vrfb(struct omap_vout_device *vout, omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE, 0x20, 0); omap_start_dma(tx->dma_ch); - interruptible_sleep_on_timeout(&tx->wait, VRFB_TX_TIMEOUT); + wait_event_interruptible_timeout(tx->wait, tx->tx_status == 1, + VRFB_TX_TIMEOUT); if (tx->tx_status == 0) { omap_stop_dma(tx->dma_ch);