From patchwork Mon Jun 2 05:22:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YoungJun Cho X-Patchwork-Id: 4279781 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B21F4BEEA7 for ; Mon, 2 Jun 2014 05:23:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA10B203B5 for ; Mon, 2 Jun 2014 05:23:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56E86203B0 for ; Mon, 2 Jun 2014 05:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751912AbaFBFW7 (ORCPT ); Mon, 2 Jun 2014 01:22:59 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:30914 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800AbaFBFW5 (ORCPT ); Mon, 2 Jun 2014 01:22:57 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6J00HE60A6BG90@mailout3.samsung.com>; Mon, 02 Jun 2014 14:22:54 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.45]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 25.18.16580.E2A0C835; Mon, 02 Jun 2014 14:22:54 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-bf-538c0a2e0f42 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 33.79.08203.E2A0C835; Mon, 02 Jun 2014 14:22:54 +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 <0N6J00KWX0A3O8D0@mmp2.samsung.com>; Mon, 02 Jun 2014 14:22:54 +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 v3 02/15] drm/exynos: use wait_event_timeout() for safety usage Date: Mon, 02 Jun 2014 14:22:38 +0900 Message-id: <1401686571-22148-3-git-send-email-yj44.cho@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1401686571-22148-1-git-send-email-yj44.cho@samsung.com> References: <1401686571-22148-1-git-send-email-yj44.cho@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsVy+t8zXV09rp5gg5+X1C1urTvHatF77iST xfwjQNaVr+/ZLPrfLGS1OPdqJaPFpPsTWCxe3LvIYtG74CqbxdmmN+wWM87vY7JYev0ik8WE 6WtZLFr3HgGKTX7JZvFz1zwWBwGPNfPWMHpc7utl8tg56y67x8rlX9g8Nq3qZPPY/u0Bq8f9 7uNMHn1bVjF6fN4kF8AZxWWTkpqTWZZapG+XwJVxcMIMloKDvBUfVv9ibGA8yt3FyMkhIWAi 8f9GEwuELSZx4d56ti5GLg4hgWWMEh8XLABKcIAV7W30h4hPZ5T4tm01M0iDkEArk8TplU4g NpuApsTzjztYQWwRAVOJjklLWUAamAWeMEmc2rwfbIOwgL9Ew8KlYDaLgK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8fBOWNAVLMSaWFZcmXuIUYKDWUmE 9+jZ7mAh3pTEyqrUovz4otKc1OJDjMlAR01klhJNzgcmmLySeENjEzMjSyMzYxNzY2PShJXE eQ+0WgcKCaQnlqRmp6YWpBbBbGHi4JRqYBS59a4oIFy1eMW2F19SVkqkCS0XNlu5nV3Fd/7R zts/bf9pX1p6VDX6dbZFiHKs0Tr/ZW2/DDMFBTccSlw06a6Y6LvXTZ/X1PJmtN18bVhrevF9 LU/LPLYgtitXOdWvOVd0fc+SDOWuTeEzzvTeYX9B2nhb4/rFn2vmHz5n970o462MfExGthJL cUaioRZzUXEiAEidVx8mAwAA 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.5 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;