From patchwork Mon Apr 1 09:22:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 2369691 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 E0F80DFB7B for ; Mon, 1 Apr 2013 09:22:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758543Ab3DAJWj (ORCPT ); Mon, 1 Apr 2013 05:22:39 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:5061 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758528Ab3DAJWj (ORCPT ); Mon, 1 Apr 2013 05:22:39 -0400 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id AZY46251; Mon, 01 Apr 2013 17:22:34 +0800 (CST) Received: from SZXEML414-HUB.china.huawei.com (10.82.67.153) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.1.323.7; Mon, 1 Apr 2013 17:22:32 +0800 Received: from localhost (10.135.76.69) by SZXEML414-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.1.323.7; Mon, 1 Apr 2013 17:22:22 +0800 From: Yijing Wang To: Bjorn Helgaas , Yinghai Lu CC: Kenji Kaneshige , , , Rafael , Hanjun Guo , , Yijing Wang Subject: [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Date: Mon, 1 Apr 2013 17:22:06 +0800 Message-ID: <1364808128-12792-1-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.11.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.135.76.69] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Use pci_hp_add_bridge() like most other hotplug drivers rather than call pci_scan_bridge() directly. Signed-off-by: Yijing Wang --- drivers/pci/hotplug/acpiphp_glue.c | 24 ++++++++++-------------- 1 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 270fdba..7d7ed3f 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -811,7 +811,7 @@ static int __ref enable_device(struct acpiphp_slot *slot) struct pci_bus *bus = slot->bridge->pci_bus; struct acpiphp_func *func; int retval = 0; - int num, max, pass; + int num; acpi_status status; if (slot->flags & SLOT_ENABLED) @@ -827,22 +827,18 @@ static int __ref enable_device(struct acpiphp_slot *slot) goto err_exit; } - max = acpiphp_max_busnr(bus); - for (pass = 0; pass < 2; pass++) { - list_for_each_entry(dev, &bus->devices, bus_list) { - if (PCI_SLOT(dev->devfn) != slot->device) + list_for_each_entry(dev, &bus->devices, bus_list) { + if (PCI_SLOT(dev->devfn) != slot->device) continue; - if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || - dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { - max = pci_scan_bridge(bus, dev, max, pass); - if (pass && dev->subordinate) { - check_hotplug_bridge(slot, dev); - pci_bus_size_bridges(dev->subordinate); - } - } + if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || + (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) + pci_hp_add_bridge(dev); + if (dev->subordinate) { + check_hotplug_bridge(slot, dev); + pci_bus_size_bridges(dev->subordinate); } } - + pci_bus_assign_resources(bus); acpiphp_sanitize_bus(bus); acpiphp_set_hpp_values(bus);