From patchwork Tue Jul 8 00:39:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YoungJun Cho X-Patchwork-Id: 4500211 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 C99DB9F1C4 for ; Tue, 8 Jul 2014 00:40:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 043A320328 for ; Tue, 8 Jul 2014 00:40:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20F1A2021F for ; Tue, 8 Jul 2014 00:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755040AbaGHAj6 (ORCPT ); Mon, 7 Jul 2014 20:39:58 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:47666 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754266AbaGHAjz (ORCPT ); Mon, 7 Jul 2014 20:39:55 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8D00EC4B6FS930@mailout1.samsung.com>; Tue, 08 Jul 2014 09:39:51 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.45]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 39.13.13369.7DD3BB35; Tue, 08 Jul 2014 09:39:51 +0900 (KST) X-AuditID: cbfee690-b7fb56d000003439-cd-53bb3dd7b0da Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 7D.42.04943.7DD3BB35; Tue, 08 Jul 2014 09:39:51 +0900 (KST) Received: from localhost.localdomain ([10.252.75.90]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8D004E2B6BRL90@mmp2.samsung.com>; Tue, 08 Jul 2014 09:39:50 +0900 (KST) From: YoungJun Cho To: airlied@linux.ie, dri-devel@lists.freedesktop.org Cc: devicetree@vger.kernel.org, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, linux-samsung-soc@vger.kernel.org, thierry.reding@gmail.com, kyungmin.park@samsung.com, inki.dae@samsung.com, kgene.kim@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, a.hajda@samsung.com Subject: [PATCH v5 02/14] drm/exynos: use wait_event_timeout() for safety usage Date: Tue, 08 Jul 2014 09:39:35 +0900 Message-id: <1404779987-5337-3-git-send-email-yj44.cho@samsung.com> X-Mailer: git-send-email 1.9.0 In-reply-to: <1404779987-5337-1-git-send-email-yj44.cho@samsung.com> References: <1404779987-5337-1-git-send-email-yj44.cho@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsVy+t8zXd3rtruDDX4e47W4te4cq0XvuZNM FvOPAFlXvr5ns+h/s5DV4tyrlYwWk+5PYLF4ce8ii0XvgqtsFmeb3rBbzDi/j8li6fWLTBYT pq9lsWjdewQoNvklm8XPXfNYHAQ81sxbw+hxua+XyWPnrLvsHiuXf2Hz2LSqk81j+7cHrB73 u48zefRtWcXo8XmTXABnFJdNSmpOZllqkb5dAlfG+e69LAV7eCuebG5jamA8zN3FyMkhIWAi 8eDZLGYIW0ziwr31bF2MXBxCAssYJX5vn8DUxcgBVrT4nT1EfDqjxKLXm1kgnFYmia2LTjKB dLMJaEo8/7iDFcQWETCV6Ji0FKyIWeAJk8SpzftZQBLCAv4Sk/vXgtksAqoSP/+vA2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wCHIxKPLwrDu4KFmJNLCuuzD3EKMHBrCTC u2I5UIg3JbGyKrUoP76oNCe1+BCjKdBVE5mlRJPzgUkmryTe0NjEzMjSyMzYxNzYWEmc90Cr daCQQHpiSWp2ampBahFMHxMHp1QDY8SvBZ77z2ySn2i2Tm7CWcU7O4rPn6p0mhYw61nO+r13 pn7sudH1NYQlaXP1duarM1e/WCMzW6KLfZprQ9V8q9SDoUUPZmVc0T9ireQru5ytPTgjXLep +Prkre7MF7J4Nx1LCxStlJLg7X/WGVrWnxOr5a7wvKRUNVoywEPK7t/FZv/jpz+1KrEUZyQa ajEXFScCAF4phY/6AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 There could be the case that the page flip operation isn't finished correctly with some abnormal condition such as panel reset. So this patch replaces wait_event() with wait_event_timeout() to avoid waiting for page flip completion infinitely. And clears exynos_crtc->pending_flip in exynos_drm_crtc_page_flip() when exynos_drm_crtc_mode_set_commit() is failed. Signed-off-by: YoungJun Cho Acked-by: Inki Dae Acked-by: Kyungmin Park Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 95c9435..3bf091d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -69,8 +69,10 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) if (mode > DRM_MODE_DPMS_ON) { /* wait for the completion of page flip. */ - wait_event(exynos_crtc->pending_flip_queue, - atomic_read(&exynos_crtc->pending_flip) == 0); + if (!wait_event_timeout(exynos_crtc->pending_flip_queue, + !atomic_read(&exynos_crtc->pending_flip), + HZ/20)) + atomic_set(&exynos_crtc->pending_flip, 0); drm_vblank_off(crtc->dev, exynos_crtc->pipe); } @@ -259,6 +261,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, spin_lock_irq(&dev->event_lock); drm_vblank_put(dev, exynos_crtc->pipe); list_del(&event->base.link); + atomic_set(&exynos_crtc->pending_flip, 0); spin_unlock_irq(&dev->event_lock); goto out;