From patchwork Wed Aug 15 21:36:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 1328811 Return-Path: X-Original-To: patchwork-dri-devel@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 BA1433FD8C for ; Wed, 15 Aug 2012 21:37:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 86EE29EF5A for ; Wed, 15 Aug 2012 14:37:48 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-gg0-f177.google.com (mail-gg0-f177.google.com [209.85.161.177]) by gabe.freedesktop.org (Postfix) with ESMTP id DB2329E7B3 for ; Wed, 15 Aug 2012 14:36:28 -0700 (PDT) Received: by ggnm2 with SMTP id m2so2453200ggn.36 for ; Wed, 15 Aug 2012 14:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=f80CSIC2QIgpUA5SO4eaF2EltID/PqRQ/nmoxUk1AdA=; b=nbDuTQgv6px3wHv9XCtX/uC2D3p9ULpbQELtElmc8+JZvrzs5obKudJb1XWZS8FFMb kfDzcedBT50m0HS2Txh+WWczO4n6ia0JBB/MPt6nv8aqm7p5DVGWHizB0ETKL1XmKbGp HhHJkZhjaj9O4skrqlcNBLbC9KV0oqeBtmTIvgkU38fBk/QapcYrhCxqCj6D5NLcRf6r C4Tg6L+fvvLPbUAOuGm5aQyA0E72c/cKn7xkAA394DxPgPzfjn1WedFgKTTVi9eJuhk/ RbI3Hdbihmy7RmhCldztZF12rL96fqvdmdRCX6pY+PaRz9imiaQUpIKHrBZ6rjf+kC3n i/qg== Received: by 10.236.191.69 with SMTP id f45mr21911797yhn.8.1345066588342; Wed, 15 Aug 2012 14:36:28 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by mx.google.com with ESMTPS id i3sm2568249anl.0.2012.08.15.14.36.26 (version=SSLv3 cipher=OTHER); Wed, 15 Aug 2012 14:36:27 -0700 (PDT) From: alexdeucher@gmail.com To: airlied@gmail.com, dri-devel@lists.freedesktop.org Subject: [PATCH 2/5] drm/radeon: clean up evergreen_get_vblank_counter Date: Wed, 15 Aug 2012 17:36:10 -0400 Message-Id: <1345066573-1492-2-git-send-email-alexdeucher@gmail.com> X-Mailer: git-send-email 1.7.7.5 In-Reply-To: <1345066573-1492-1-git-send-email-alexdeucher@gmail.com> References: <1345066573-1492-1-git-send-email-alexdeucher@gmail.com> Cc: Alex Deucher 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 From: Alex Deucher Use the new offset array rather than open coding it. Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/evergreen.c | 18 +++--------------- 1 files changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 0c79d9e..585c117 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -2345,22 +2345,10 @@ int evergreen_asic_reset(struct radeon_device *rdev) u32 evergreen_get_vblank_counter(struct radeon_device *rdev, int crtc) { - switch (crtc) { - case 0: - return RREG32(CRTC_STATUS_FRAME_COUNT + EVERGREEN_CRTC0_REGISTER_OFFSET); - case 1: - return RREG32(CRTC_STATUS_FRAME_COUNT + EVERGREEN_CRTC1_REGISTER_OFFSET); - case 2: - return RREG32(CRTC_STATUS_FRAME_COUNT + EVERGREEN_CRTC2_REGISTER_OFFSET); - case 3: - return RREG32(CRTC_STATUS_FRAME_COUNT + EVERGREEN_CRTC3_REGISTER_OFFSET); - case 4: - return RREG32(CRTC_STATUS_FRAME_COUNT + EVERGREEN_CRTC4_REGISTER_OFFSET); - case 5: - return RREG32(CRTC_STATUS_FRAME_COUNT + EVERGREEN_CRTC5_REGISTER_OFFSET); - default: + if (crtc >= rdev->num_crtc) return 0; - } + else + return RREG32(CRTC_STATUS_FRAME_COUNT + crtc_offsets[crtc]); } void evergreen_disable_interrupt_state(struct radeon_device *rdev)