From patchwork Wed Aug 1 15:54:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 1265131 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 26F98DF215 for ; Wed, 1 Aug 2012 16:01:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750824Ab2HAQB1 (ORCPT ); Wed, 1 Aug 2012 12:01:27 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:36668 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755556Ab2HAQAD (ORCPT ); Wed, 1 Aug 2012 12:00:03 -0400 Received: by yhmm54 with SMTP id m54so7461005yhm.19 for ; Wed, 01 Aug 2012 09:00:02 -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=g4EFVFWKE39OEDPhfxEhmfxbxPdzk3bDbSAT8tnoNoE=; b=FdBAEy19OsP7RW1PjN9rmYa354er0UXX+ZFi3PFTjaYsQxF5xmz8fmHEbUSzwD9jr/ SMtQT1I3jPLnxbsl4YaCubHzrfwfzl8Xtw6FuPvfG5zwDeS1mqBH8vxlTNnJFc8w0/yG 8viFH5cJwdg3Iy/UqkHVvYYclRFjGHwqCkMh95IrosCzuo4sOSjbpLGlKR4hnhoff45m 7Tzx/UcD3ev7MvPyF+y/WNcggI0y9070FFYp9hTBGrAgealseIm/+YDwqCuRCln3Fihs FRabDEemqaDZ0IckYEVr61ERB5pYcuPz9+62V9p6p4Mybf/RomP4BboysIOR0C726zLH TS4g== Received: by 10.66.75.229 with SMTP id f5mr40812124paw.47.1343836801941; Wed, 01 Aug 2012 09:00:01 -0700 (PDT) Received: from localhost.localdomain ([58.250.81.2]) by mx.google.com with ESMTPS id pe8sm2816231pbc.76.2012.08.01.08.59.50 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Aug 2012 08:59:59 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Don Dutile , David Airlie , Dave Airlie , Alex Deucher , Jerome Glisse Cc: Jiang Liu , Yinghai Lu , Taku Izumi , "Rafael J . Wysocki" , Kenji Kaneshige , Yijing Wang , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Jiang Liu Subject: [PATCH v3 29/32] PCI/radeon: use PCIe capabilities access functions to simplify implementation Date: Wed, 1 Aug 2012 23:54:34 +0800 Message-Id: <1343836477-7287-30-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343836477-7287-1-git-send-email-jiang.liu@huawei.com> References: <1343836477-7287-1-git-send-email-jiang.liu@huawei.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Jiang Liu Use PCIe capabilities access functions to simplify radeon driver's implementation. Signed-off-by: Jiang Liu Reviewed-by: Alex Deucher --- drivers/gpu/drm/radeon/evergreen.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 01550d0..8804c80 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -77,13 +77,9 @@ void evergreen_tiling_fields(unsigned tiling_flags, unsigned *bankw, void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev) { u16 ctl, v; - int cap, err; + int err; - cap = pci_pcie_cap(rdev->pdev); - if (!cap) - return; - - err = pci_read_config_word(rdev->pdev, cap + PCI_EXP_DEVCTL, &ctl); + err = pci_pcie_capability_read_word(rdev->pdev, PCI_EXP_DEVCTL, &ctl); if (err) return; @@ -95,7 +91,7 @@ void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev) if ((v == 0) || (v == 6) || (v == 7)) { ctl &= ~PCI_EXP_DEVCTL_READRQ; ctl |= (2 << 12); - pci_write_config_word(rdev->pdev, cap + PCI_EXP_DEVCTL, ctl); + pci_pcie_capability_write_word(rdev->pdev, PCI_EXP_DEVCTL, ctl); } }