From patchwork Mon May 6 15:56:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Harvey X-Patchwork-Id: 2544911 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id BD34EDF24C for ; Thu, 9 May 2013 18:01:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 95D1BE6373 for ; Thu, 9 May 2013 11:01:29 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mtxmxout5.matrox.com (mtxmxout5.matrox.com [138.11.2.95]) by gabe.freedesktop.org (Postfix) with ESMTP id 04C48E6350 for ; Thu, 9 May 2013 10:58:54 -0700 (PDT) Received: from venus.matrox.com (venus.matrox.com [192.168.1.30]) by mtxmxout5.matrox.com (Postfix) with ESMTP id C94E01C6D75 for ; Thu, 9 May 2013 13:58:53 -0400 (EDT) Received: (from ssmsp@localhost) by venus.matrox.com (8.14.4/8.13.2) id r49HwrfV014369 for dri-devel@lists.freedesktop.org; Thu, 9 May 2013 13:58:53 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by venus.matrox.com (Postfix) with ESMTP id 4C0AAF4DB8 for ; Thu, 9 May 2013 13:58:53 -0400 (EDT) X-Virus-MTX-Scanned: by Matrox Virus scanner at venus.matrox.com Received: from pluton.matrox.com (pluton.matrox.com [192.168.8.7]) by venus.matrox.com (Postfix) with ESMTP id 2B259F4DB5 for ; Thu, 9 May 2013 13:58:53 -0400 (EDT) Received: from matrox.com (dyn-152-224.matrox.com [192.168.152.224]) by pluton.matrox.com (Postfix) with ESMTP id 24A2F7F45F; Thu, 9 May 2013 13:58:53 -0400 (EDT) Message-Id: <7c7a4749fb6bea17260c749e211522c96de57455.1368122227.git.charvey@matrox.com> In-Reply-To: References: From: Christopher Harvey Date: Mon, 6 May 2013 11:56:17 -0400 Subject: [PATCH 3/4] drm/mgag200: Convert counter delays to jiffies To: dri-devel@lists.freedesktop.org Cc: Mathieu Larouche X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Signed-off-by: Christopher Harvey --- drivers/gpu/drm/mgag200/mgag200_mode.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 6f3b9db..6dbf6de 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -46,29 +46,26 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc) static inline void mga_wait_vsync(struct mga_device *mdev) { - unsigned int count = 0; + unsigned long timeout = jiffies + HZ/10; unsigned int status = 0; do { status = RREG32(MGAREG_Status); - count++; - } while ((status & 0x08) && (count < 250000)); - count = 0; + } while ((status & 0x08) && time_before(jiffies, timeout)); + timeout = jiffies + HZ/10; status = 0; do { status = RREG32(MGAREG_Status); - count++; - } while (!(status & 0x08) && (count < 250000)); + } while (!(status & 0x08) && time_before(jiffies, timeout)); } static inline void mga_wait_busy(struct mga_device *mdev) { - unsigned int count = 0; + unsigned long timeout = jiffies + HZ; unsigned int status = 0; do { status = RREG8(MGAREG_Status + 2); - count++; - } while ((status & 0x01) && (count < 500000)); + } while ((status & 0x01) && time_before(jiffies, timeout)); } /*