From patchwork Tue Jul 24 16:41:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 1232581 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 88494DF25A for ; Tue, 24 Jul 2012 16:45:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755523Ab2GXQoN (ORCPT ); Tue, 24 Jul 2012 12:44:13 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:33470 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753864Ab2GXQoJ (ORCPT ); Tue, 24 Jul 2012 12:44:09 -0400 Received: by pbbrp8 with SMTP id rp8so12927425pbb.19 for ; Tue, 24 Jul 2012 09:44:09 -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=526SwMcLGMdfDlLKr/L7Jp8OwFF+n3Iudk4+Xft9QTs=; b=JJUWbRxln0LXHuE674kbuC//UVOFDfTvTkrM2FCrxRV4PObLU3pqWxWPsEUwznfBm/ mkjP/7TfQMC/fNebwra8bHZinqT+AAXQLqytIRdtoj1xBEK+5Nen9vyETlqzNPU2DNUS IAuKih+lrbr6yNLPQ8NFKhjl7iu1ex0pLd4RjLqY11PxZc4bYyju/7G2lIaLdLAboJRi RJlY1HErB4Z0Sv892cYxXZ2wALMrnf6mXxpjkJRrfdx/fI/oQ+/3Un3u1PD1OdlAQOLo GzRlui3SlO7tbQJ2BpopI2Ro2Pp2Prva12kzlzEDQZ0DK7nAUPo6w+cGZSxJaovJ+/Hw CMmQ== Received: by 10.68.193.196 with SMTP id hq4mr4588281pbc.76.1343148249516; Tue, 24 Jul 2012 09:44:09 -0700 (PDT) Received: from localhost.localdomain ([221.221.26.244]) by mx.google.com with ESMTPS id wk10sm7863878pbc.71.2012.07.24.09.43.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 09:44:06 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Don Dutile 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: [RFC PATCH v2 29/32] PCI/radeon: use PCIe capabilities access functions to simplify implementation Date: Wed, 25 Jul 2012 00:41:14 +0800 Message-Id: <1343148077-25941-6-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343148077-25941-1-git-send-email-jiang.liu@huawei.com> References: <1343148077-25941-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 --- drivers/gpu/drm/radeon/evergreen.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 01550d0..d7a1f95 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -77,13 +77,12 @@ 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) + if (!pci_is_pcie(rdev->pdev)) 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 +94,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); } }