From patchwork Sat Dec 22 19:01:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Kannebley Tavares X-Patchwork-Id: 207934 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F1BF72C008A for ; Sun, 23 Dec 2012 06:02:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751973Ab2LVTCJ (ORCPT ); Sat, 22 Dec 2012 14:02:09 -0500 Received: from e24smtp03.br.ibm.com ([32.104.18.24]:40538 "EHLO e24smtp03.br.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751946Ab2LVTCI (ORCPT ); Sat, 22 Dec 2012 14:02:08 -0500 Received: from /spool/local by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 22 Dec 2012 17:02:07 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp03.br.ibm.com (10.172.0.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 22 Dec 2012 17:02:06 -0200 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 903AA1DC0028; Sat, 22 Dec 2012 14:02:05 -0500 (EST) Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qBMJ1AXw2175192; Sat, 22 Dec 2012 17:01:10 -0200 Received: from d24av03.br.ibm.com (loopback [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qBMH2ROu002768; Sat, 22 Dec 2012 15:02:28 -0200 Received: from oc4135502304.ibm.com ([9.78.144.202]) by d24av03.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id qBMH2Qo9002758; Sat, 22 Dec 2012 15:02:27 -0200 Message-ID: <50D6039D.4000001@linux.vnet.ibm.com> Date: Sat, 22 Dec 2012 17:01:49 -0200 From: Lucas Kannebley Tavares User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 MIME-Version: 1.0 To: Bjorn Helgaas CC: dri-devel@lists.freedesktop.org, David Airlie , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, brking@linux.vnet.ibm.com, benh@au1.ibm.com, Betty Dall , Thadeu Lima de Souza Cascardo Subject: [PATCH] drm: fixed access to PCI host bridges References: <50CA5EE2.30206@linux.vnet.ibm.com> <50D60349.7080400@linux.vnet.ibm.com> In-Reply-To: <50D60349.7080400@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12122219-9254-0000-0000-00000B1EE9D6 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org During the process of obtaining the speed cap for the device, it attempts go get the PCI Host bus. However on architectures such as PPC or IA64, those do not appear as devices. Signed-off-by: Lucas Kannebley Tavares --- drivers/gpu/drm/drm_pci.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) return -EINVAL; diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 754bc96..ea41234 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -479,8 +479,13 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask) if (!pci_is_pcie(dev->pdev)) return -EINVAL; + // find PCI device for capabilities root = dev->pdev->bus->self; + // some architectures might not have host bridges as PCI devices + if (root == NULL) + root = dev->pdev; + pos = pci_pcie_cap(root); if (!pos)