From patchwork Wed Nov 19 07:32:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangyijing X-Patchwork-Id: 41101 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3DA3A20CBB for ; Wed, 19 Nov 2014 06:56:02 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf4488145wgh.8 for ; Tue, 18 Nov 2014 22:56:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:mime-version:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=Zug5c7pCdDRAmNnRy2o2jKoO9FEMIquvLNZk0kPcJYM=; b=AED9EvHvhRsg+iU4ZN9HuXaIy1ozoRMuH6h+vUEvCViuDdxvA/qP9L0Lt4FgmE/Dfv 5gmYI2LW0YBiRTx3yH0eI8R5+zfhhDySlVW5EyG8WSt+XCpH7Os3D4ZDax5JMGi578lY hqqKh7Jz2O0GebnSXxY0ua8aFCWP07UmeOvtlLMuYasQ78Ojih26RWmKU9MDBYyfMDc7 09gKjNeVMGb3kvt6/tg3oPg+iJa/IHCdrMbzjbSA94daU+P0pd5UCho3elp3xYeZpWrR sIrGpyG9W06hcEjOsF2HDa/NKXUDPGnfkNNshJA3Mto0/hPAY8pSUXk934kxk/eFVASu pU2Q== X-Gm-Message-State: ALoCoQnQUSmDm4fXQXVn2uTlCWVkIPkcRRWngAqC93J5X6YP2E4PaqC2Ke7pC7EP7ljQqIHKN06m X-Received: by 10.112.199.167 with SMTP id jl7mr4468436lbc.5.1416380161473; Tue, 18 Nov 2014 22:56:01 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.200 with SMTP id n8ls1257695lag.10.gmail; Tue, 18 Nov 2014 22:56:01 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr3743785lbc.34.1416380161333; Tue, 18 Nov 2014 22:56:01 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id an9si758545lac.122.2014.11.18.22.56.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 22:56:01 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id z11so11715017lbi.25 for ; Tue, 18 Nov 2014 22:56:01 -0800 (PST) X-Received: by 10.152.20.130 with SMTP id n2mr3710359lae.39.1416380161203; Tue, 18 Nov 2014 22:56:01 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp37290lbc; Tue, 18 Nov 2014 22:56:00 -0800 (PST) X-Received: by 10.68.108.36 with SMTP id hh4mr9419305pbb.108.1416380159605; Tue, 18 Nov 2014 22:55:59 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ln4si1203110pab.151.2014.11.18.22.55.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Nov 2014 22:55:59 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xqz9l-0004mH-8d; Wed, 19 Nov 2014 06:54:25 +0000 Received: from szxga01-in.huawei.com ([119.145.14.64]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xqz9g-0003eV-0Y for linux-arm-kernel@lists.infradead.org; Wed, 19 Nov 2014 06:54:21 +0000 Received: from 172.24.2.119 (EHLO szxeml450-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CEQ74323; Wed, 19 Nov 2014 14:51:53 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml450-hub.china.huawei.com (10.82.67.193) with Microsoft SMTP Server id 14.3.158.1; Wed, 19 Nov 2014 14:51:40 +0800 From: Yijing Wang To: Bjorn Helgaas Subject: [PATCH 1/5] PCI: Rip out pci_bus_add_devices() from pci_scan_bus() Date: Wed, 19 Nov 2014 15:32:45 +0800 Message-ID: <1416382369-13587-2-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1416382369-13587-1-git-send-email-wangyijing@huawei.com> References: <1416382369-13587-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141118_225420_504970_0FFD5DFE X-CRM114-Status: GOOD ( 15.13 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [119.145.14.64 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [119.145.14.64 listed in wl.mailspike.net] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Liviu Dudau , Tony Luck , Russell King , Arnd Bergmann , linux-pci@vger.kernel.org, x86@kernel.org, sparclinux@vger.kernel.org, linux-m68k@lists.linux-m68k.org, Geert Uytterhoeven , linux-alpha@vger.kernel.org, Yijing Wang , linux-ia64@vger.kernel.org, Thomas Gleixner , Guan Xuetao , "David S. Miller" , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangyijing@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Pci_bus_add_devices() should not be placed in pci_scan_bus(). Now pci devices will be added to driver core once its creation. All the things left in pci_bus_add_devices() are driver attach and other trivial things. pci_scan_bus() should be the function responsible for scanning PCI devices, not including device driver attached. Other, lots callers of pci_scan_bus() call pci_bus_size_bridges() and pci_bus_assign_resources() after pci_scan_bus(). It's not correct, but because pci_scan_bus() always be called before driver loaded, so maybe no problem will cause. We should rip out pci_bus_add_devices() for better code design. No functional change. Signed-off-by: Yijing Wang CC: "David S. Miller" CC: Geert Uytterhoeven CC: Guan Xuetao CC: linux-alpha@vger.kernel.org CC: linux-m68k@lists.linux-m68k.org CC: sparclinux@vger.kernel.org --- arch/alpha/kernel/sys_nautilus.c | 1 + arch/m68k/coldfire/pci.c | 1 + arch/sparc/kernel/pcic.c | 2 ++ arch/unicore32/kernel/pci.c | 11 +++-------- drivers/pci/hotplug/ibmphp_core.c | 6 ++++-- drivers/pci/probe.c | 1 - 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 837c0fa..4ae4a40 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c @@ -253,6 +253,7 @@ nautilus_init_pci(void) for the root bus, so just clear it. */ bus->self = NULL; pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq); + pci_bus_add_devices(bus); } /* diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c index df96792..d45f087 100644 --- a/arch/m68k/coldfire/pci.c +++ b/arch/m68k/coldfire/pci.c @@ -319,6 +319,7 @@ static int __init mcf_pci_init(void) pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq); pci_bus_size_bridges(rootbus); pci_bus_assign_resources(rootbus); + pci_bus_add_devices(rootbus); return 0; } diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index 6cc78c2..7a82fe2 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c @@ -391,6 +391,8 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic) struct linux_pbm_info *pbm = &pcic->pbm; pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm); + if (pbm->pci_bus) + pci_bus_add_devices(pbm->pci_bus); #if 0 /* deadwood transplanted from sparc64 */ pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node); pci_record_assignments(pbm, pbm->pci_bus); diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c index 374a055..3d82024 100644 --- a/arch/unicore32/kernel/pci.c +++ b/arch/unicore32/kernel/pci.c @@ -266,17 +266,12 @@ static int __init pci_common_init(void) pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq); if (!pci_has_flag(PCI_PROBE_ONLY)) { - /* - * Size the bridge windows. - */ + /* Size the bridge windows. */ pci_bus_size_bridges(puv3_bus); - - /* - * Assign resources. - */ + /* Assign resources. */ pci_bus_assign_resources(puv3_bus); } - + pci_bus_add_devices(puv3_bus); return 0; } subsys_initcall(pci_common_init); diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index 3efaf4c..db0f2e8 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c @@ -740,7 +740,7 @@ static void ibm_unconfigure_device(struct pci_func *func) */ static u8 bus_structure_fixup(u8 busno) { - struct pci_bus *bus; + struct pci_bus *bus, *b; struct pci_dev *dev; u16 l; @@ -767,7 +767,9 @@ static u8 bus_structure_fixup(u8 busno) (l != 0x0000) && (l != 0xffff)) { debug("%s - Inside bus_structure_fixup()\n", __func__); - pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL); + b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL); + if (b) + pci_bus_add_devices(b); break; } } diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index db16678..5c5e01e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2120,7 +2120,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources); if (b) { pci_scan_child_bus(b); - pci_bus_add_devices(b); } else { pci_free_resource_list(&resources); }