From patchwork Thu Mar 28 10:31:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2355961 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id DB6A73FD40 for ; Thu, 28 Mar 2013 10:43:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C0EC3E5C1D for ; Thu, 28 Mar 2013 03:43:32 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ea0-f178.google.com (mail-ea0-f178.google.com [209.85.215.178]) by gabe.freedesktop.org (Postfix) with ESMTP id B8CFBE5C1D for ; Thu, 28 Mar 2013 03:43:22 -0700 (PDT) Received: by mail-ea0-f178.google.com with SMTP id o10so737573eaj.37 for ; Thu, 28 Mar 2013 03:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=ZV98T0mkRFVFtcpbwdqtAKaxOjf6BhTKAwFpHNKkPsI=; b=FGldhCcGFxSQwNQ6yQv+Epy0UvoSAw7ituPI6PKuL1U7jQpOtVG8YCGNYqnSyJWzL8 w9LwPzQNbmsY6sar3G27lyZ1zltm3WLgk+LrrI4syQjbpOrjauopciAMx+Lt87oGd/eP u9lymWNFfbcfjeA9fTkXPzgTbCee1EOf0Zn5M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=ZV98T0mkRFVFtcpbwdqtAKaxOjf6BhTKAwFpHNKkPsI=; b=hIkdJU6F+pOfUcq9wzYhn64gwKrJt9qfYPSTi9dZ/ixLTSInEJKu2erlvTptpHivEq 3ZAtZsvA0xFxL+ts8qz/il7l0exXB3qisvxv8DPL57CJtHNGii/6uXYvOzr0fYaAxosg gAa9ELOf21IX8AIkazQ71Vk2/xKj7ZmembFNl6edUP/PmiZ+zDb9SP+1PZUy3RNt1Ibx n89lPMk0f6L1zk8fZOPACdBngfezRbwKqtT6oUnYRvOToad5l2C4JIzSK9jd1Ck9hPv6 EgPObOmxTNp6Z7j6+Ont5Zqp68t1pB9my/y2ycse2gE5SjZXubwdVpjxZKym8PWsYMUG oSOA== X-Received: by 10.14.109.71 with SMTP id r47mr39032776eeg.25.1364467401527; Thu, 28 Mar 2013 03:43:21 -0700 (PDT) Received: from wespe.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id m46sm36840663eeo.16.2013.03.28.03.43.19 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 Mar 2013 03:43:20 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 28 Mar 2013 11:31:04 +0100 Message-Id: <1364466664-21037-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <20130328103233.GH4469@intel.com> References: <20130328103233.GH4469@intel.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQk6S5h672e/lxTqLNk325EAvXb3peV7ilbaWAWE5mqA5mBZTIncmeREf6qtFvpxNcJpcnTU Cc: Daniel Vetter , Jack Winter Subject: [Intel-gfx] [PATCH] drm/i915: fold wait_for_atomic_us into wait_for_atomic X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Since commit bcf9dcc1e6269fac674e41f25d007ff75f76e840 Author: Chris Wilson Date: Sun Jul 15 09:42:38 2012 +0100 drm/i915: Workaround hang with BSD and forcewake on SandyBridge and commit 0cc2764cc4a4bd73df55f8893c871778cf7ddd0f Author: Ben Widawsky Date: Sat Sep 1 22:59:48 2012 -0700 drm/i915: use cpu_relax() in wait_for_atomic these two macros are essentially the same, so unify them. We keep the _us version since it's a nice documentation for smaller timeouts. v2: Fixup time unit conversion, _wait_for takes ms (Ville). Cc: Jack Winter Cc: Ville Syrjälä Signed-off-by: Daniel Vetter Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/i915/intel_drv.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 54bc2ea..8e76f52f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -50,21 +50,10 @@ ret__; \ }) -#define wait_for_atomic_us(COND, US) ({ \ - unsigned long timeout__ = jiffies + usecs_to_jiffies(US); \ - int ret__ = 0; \ - while (!(COND)) { \ - if (time_after(jiffies, timeout__)) { \ - ret__ = -ETIMEDOUT; \ - break; \ - } \ - cpu_relax(); \ - } \ - ret__; \ -}) - #define wait_for(COND, MS) _wait_for(COND, MS, 1) #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0) +#define wait_for_atomic_us(COND, US) _wait_for((COND), \ + DIV_ROUND_UP((US), 1000), 0) #define KHz(x) (1000*x) #define MHz(x) KHz(1000*x)