From patchwork Fri Jun 29 06:47:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 1130821 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 83CE0DFF34 for ; Fri, 29 Jun 2012 06:48:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751257Ab2F2Gst (ORCPT ); Fri, 29 Jun 2012 02:48:49 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:46559 "EHLO e7.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428Ab2F2Gss (ORCPT ); Fri, 29 Jun 2012 02:48:48 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 29 Jun 2012 02:48:47 -0400 Received: from d01relay04.pok.ibm.com (9.56.227.236) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 29 Jun 2012 02:47:58 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5T6lvKF400228 for ; Fri, 29 Jun 2012 02:47:57 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5T6ltcP006825 for ; Fri, 29 Jun 2012 02:47:56 -0400 Received: from shangw ([9.77.178.49]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q5T6lslq006782; Fri, 29 Jun 2012 02:47:55 -0400 Received: by shangw (Postfix, from userid 1000) id 36BA93818B1; Fri, 29 Jun 2012 14:47:53 +0800 (CST) From: Gavin Shan To: linux-pci@vger.kernel.org, linuxppc-dev@ozlabs.org Cc: bhelgaas@google.com, yinghai@kernel.org, benh@kernel.crashing.org, linuxram@us.ibm.com, Gavin Shan Subject: [PATCH 2/7] pci: argument pci_bus for find_pci_host_bridge Date: Fri, 29 Jun 2012 14:47:45 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: x-cbid: 12062906-5806-0000-0000-000016C78CD4 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 file 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;