{"id":958751,"url":"http://patchwork.ozlabs.org/api/patches/958751/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20180817102645.3839621-9-arnd@arndb.de/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20180817102645.3839621-9-arnd@arndb.de>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20180817102645.3839621-9-arnd@arndb.de/","date":"2018-08-17T10:26:38","name":"[RFC,08/15] x86: PCI: clean up pcibios_scan_root()","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"1db1246f22a9b949467380217da930bba379aeaf","submitter":{"id":30,"url":"http://patchwork.ozlabs.org/api/people/30/?format=json","name":"Arnd Bergmann","email":"arnd@arndb.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20180817102645.3839621-9-arnd@arndb.de/mbox/","series":[{"id":61229,"url":"http://patchwork.ozlabs.org/api/series/61229/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=61229","date":"2018-08-17T10:26:32","name":"PCI: turn some __weak functions into callbacks","version":1,"mbox":"http://patchwork.ozlabs.org/series/61229/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/958751/comments/","check":"warning","checks":"http://patchwork.ozlabs.org/api/patches/958751/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 41sKPB16Zyz9s3x\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 17 Aug 2018 20:36:14 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 41sKP96P3vzF0pD\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 17 Aug 2018 20:36:13 +1000 (AEST)","from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 41sKK45V5rzDqm6\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 17 Aug 2018 20:32:40 +1000 (AEST)","from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de\n\t(mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id\n\t0LgHVU-1gBMPa1mGS-00ngPB; Fri, 17 Aug 2018 12:27:18 +0200"],"Authentication-Results":["ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=arndb.de","lists.ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=arndb.de","lists.ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=arndb.de\n\t(client-ip=212.227.17.24; helo=mout.kundenserver.de;\n\tenvelope-from=arnd@arndb.de; receiver=<UNKNOWN>)","lists.ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=arndb.de"],"X-Greylist":"delayed 300 seconds by postgrey-1.36 at bilbo;\n\tFri, 17 Aug 2018 20:32:40 AEST","From":"Arnd Bergmann <arnd@arndb.de>","To":"linux-pci@vger.kernel.org,\n\tBjorn Helgaas <bhelgaas@google.com>","Subject":"[RFC 08/15] x86: PCI: clean up pcibios_scan_root()","Date":"Fri, 17 Aug 2018 12:26:38 +0200","Message-Id":"<20180817102645.3839621-9-arnd@arndb.de>","X-Mailer":"git-send-email 2.18.0","In-Reply-To":"<20180817102645.3839621-1-arnd@arndb.de>","References":"<20180817102645.3839621-1-arnd@arndb.de>","X-Provags-ID":"V03:K1:tlcedIIbu3wiz3zsxlYn2+G+v0etxI3PP6TAmZreLsijFeYR04M\n\th/VODDtc+5SUwz1uyxw71Eq8VwF/rrPeX4Mi73yyRzW86zhOmQypatEJjTmy5UJ8/VTs3si\n\tOr6SucrdTdcrzJKrTR3QI43wWqbF1ZN69gr+AUCaoNRbF51vgqmBAbIdS99XUNw57/qq4KP\n\t6/LoQH+SxPzNn6+AMM4rg==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:weQ6RTKTUsY=:XbEL7s+SkjRfvaO/OBnUBt\n\tht0iALf7RLwZ+Pg4PqsRtLWIZH4P1cYoeJV2Ihh0UQD1qouQ1J3OdYGV47+3L395N4n9voRlw\n\tIH4kXgIGHDHCQojbrS3ViJndFx6PJGDA8jk0NkZUSTLdBLzcbHAXrOjmUbSx6xv3rPr1Y86YB\n\tOJXCDPtboW5sf4qcQm0weWm/5Knr32PPYh5RgJrZ96UyNL/oNUnxMttcHcBswPlYdETa8AAXh\n\tjikLLMG11oGfgI10VBT2eShT/ILBVvB+eQSbge2txFONEJ66ESQjUnT38uBXBC4XvkO3kd+zl\n\tk+bscHpGd3QyNeWxs8XZyzPmhNKsXNjOdqUU+7yfMAp0UgSwH7Fn/a9JkbkN21WNBAOLUx6lE\n\tu+g4OrVQFBzvcwkmwHY4WKdpYQv3pKzYkKDCNmHQptwy7ynQkXmd2n5dq9hyDTsnkE63eTbWG\n\tzCHFSRlEIpUfEdU/YuNCSJJIFcyGYt08H+qwfW9+OxsHZo5qCQSOEqq47OtnyIJANhMhiD+pP\n\tYeLmH89ATYf2Ug1E9TPiz3qcV3UGNuP3s3iW7iJjJChA5hN+Hg52TgED0fTWiH/i+nPQ8oUde\n\teSO38j3Y3kkOt93/38VBYsVKkPRXM0J5QLiplQndvAB9Xr3l9hshp9Dopw2tthNxH4X3CDbPP\n\tjXxyPaG7Fw9HHSQZMuplcmXPAS09LGPqYRYwgkvq7V313AabwV/yRxpFa3DBpIdTwt+U=","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.27","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,\n\tArnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org,\n\tChristoph Hellwig <hch@infradead.org>, linux-acpi@vger.kernel.org,\n\tlinuxppc-dev@lists.ozlabs.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"pcibios_scan_root() is now just a wrapper around pci_scan_root_bus(),\nand merging the two into one makes it shorter and more readable.\n\nWe can also take advantage of pci_alloc_host_bridge() doing the\nallocation of the sysdata for us, which helps if we ever want to\nallow hot-unplugging the host bridge itself.\n\nWe might be able to simplify it further using pci_host_probe(),\nbut I wasn't sure about the resource registration there.\n\nSigned-off-by: Arnd Bergmann <arnd@arndb.de>\n---\n arch/x86/pci/common.c | 53 ++++++++++++++-----------------------------\n 1 file changed, 17 insertions(+), 36 deletions(-)","diff":"diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c\nindex e740d9aa4024..920d0885434c 100644\n--- a/arch/x86/pci/common.c\n+++ b/arch/x86/pci/common.c\n@@ -453,54 +453,35 @@ void __init dmi_check_pciprobe(void)\n \tdmi_check_system(pciprobe_dmi_table);\n }\n \n-static struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,\n-\t\tstruct pci_ops *ops, void *sysdata, struct list_head *resources)\n+void pcibios_scan_root(int busnum)\n {\n+\tstruct pci_sysdata *sd;\n \tstruct pci_host_bridge *bridge;\n \tint error;\n \n-\tbridge = pci_alloc_host_bridge(0);\n-\tif (!bridge)\n-\t\treturn NULL;\n+\tbridge = pci_alloc_host_bridge(sizeof(sd));\n+\tif (!bridge) {\n+\t\tprintk(KERN_ERR \"PCI: OOM, skipping PCI bus %02x\\n\", busnum);\n+\t\treturn;\n+\t}\n+\tsd = pci_host_bridge_priv(bridge);\n \n-\tlist_splice_init(resources, &bridge->windows);\n-\tbridge->dev.parent = parent;\n-\tbridge->sysdata = sysdata;\n-\tbridge->busnr = bus;\n-\tbridge->ops = ops;\n+\tsd->node = x86_pci_root_bus_node(busnum);\n+\tx86_pci_root_bus_resources(busnum, &bridge->windows);\n+\tbridge->sysdata = sd;\n+\tbridge->busnr = busnum;\n+\tbridge->ops = &pci_root_ops;\n \n+\tprintk(KERN_DEBUG \"PCI: Probing PCI hardware (bus %02x)\\n\", busnum);\n \terror = pci_scan_root_bus_bridge(bridge);\n \tif (error < 0)\n \t\tgoto err_out;\n \n-\treturn bridge->bus;\n+\tpci_bus_add_devices(bridge->bus);\n+\treturn;\n \n err_out:\n-\tkfree(bridge);\n-\treturn NULL;\n-}\n-\n-void pcibios_scan_root(int busnum)\n-{\n-\tstruct pci_bus *bus;\n-\tstruct pci_sysdata *sd;\n-\tLIST_HEAD(resources);\n-\n-\tsd = kzalloc(sizeof(*sd), GFP_KERNEL);\n-\tif (!sd) {\n-\t\tprintk(KERN_ERR \"PCI: OOM, skipping PCI bus %02x\\n\", busnum);\n-\t\treturn;\n-\t}\n-\tsd->node = x86_pci_root_bus_node(busnum);\n-\tx86_pci_root_bus_resources(busnum, &resources);\n-\tprintk(KERN_DEBUG \"PCI: Probing PCI hardware (bus %02x)\\n\", busnum);\n-\tbus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);\n-\tif (!bus) {\n-\t\tpci_free_resource_list(&resources);\n-\t\tkfree(sd);\n-\t\treturn;\n-\t}\n-\tpci_bus_add_devices(bus);\n+\tpci_free_host_bridge(bridge);\n }\n \n void __init pcibios_set_cache_line_size(void)\n","prefixes":["RFC","08/15"]}