From patchwork Wed Jul 25 01:49:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 1233771 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 578BC3FF1C for ; Wed, 25 Jul 2012 01:50:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755122Ab2GYBuT (ORCPT ); Tue, 24 Jul 2012 21:50:19 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:59292 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753967Ab2GYBuS (ORCPT ); Tue, 24 Jul 2012 21:50:18 -0400 Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Jul 2012 19:50:17 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 24 Jul 2012 19:50:07 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id AA7E53E4003E for ; Wed, 25 Jul 2012 01:50:05 +0000 (WET) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6P1o668162596 for ; Tue, 24 Jul 2012 19:50:06 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6P1o556016308 for ; Tue, 24 Jul 2012 19:50:06 -0600 Received: from shangw (shangw.cn.ibm.com [9.125.213.201]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q6P1o2sP016143; Tue, 24 Jul 2012 19:50:03 -0600 Received: by shangw (Postfix, from userid 1000) id 2C8C1302DAC; Wed, 25 Jul 2012 09:50:01 +0800 (CST) From: Gavin Shan To: linux-pci@vger.kernel.org Cc: bhelgaas@google.com, benh@kernel.crashing.org, linuxram@us.ibm.com, Gavin Shan , Yinghai Lu Subject: [PATCH 2/8] pci: argument pci_bus for find_pci_host_bridge Date: Wed, 25 Jul 2012 09:49:51 +0800 Message-Id: <1343180997-9483-3-git-send-email-shangw@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1343180997-9483-1-git-send-email-shangw@linux.vnet.ibm.com> References: <1343180997-9483-1-git-send-email-shangw@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12072501-2398-0000-0000-000008CB83B2 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The patch changes the argument of find_pci_host_bridge() to pci_bus. Signed-off-by: Yinghai Lu Signed-off-by: Gavin Shan --- drivers/pci/host-bridge.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index c19776a..fc16357 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -9,20 +9,17 @@ #include "pci.h" -static struct pci_bus *find_pci_root_bus(struct pci_dev *dev) +static struct pci_bus *find_pci_root_bus(struct pci_bus *bus) { - struct pci_bus *bus; - - bus = dev->bus; while (bus->parent) bus = bus->parent; return bus; } -static struct pci_host_bridge *find_pci_host_bridge(struct pci_dev *dev) +static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus) { - struct pci_bus *root_bus = find_pci_root_bus(dev); + struct pci_bus *root_bus = find_pci_root_bus(bus); return to_pci_host_bridge(root_bus->bridge); } @@ -43,7 +40,7 @@ static bool resource_contains(struct resource *res1, struct resource *res2) void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res) { - struct pci_host_bridge *bridge = find_pci_host_bridge(dev); + struct pci_host_bridge *bridge = find_pci_host_bridge(dev->bus); struct pci_host_bridge_window *window; resource_size_t offset = 0; @@ -71,7 +68,7 @@ static bool region_contains(struct pci_bus_region *region1, void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region) { - struct pci_host_bridge *bridge = find_pci_host_bridge(dev); + struct pci_host_bridge *bridge = find_pci_host_bridge(dev->bus); struct pci_host_bridge_window *window; resource_size_t offset = 0;