{"id":958759,"url":"http://patchwork.ozlabs.org/api/patches/958759/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20180817102645.3839621-2-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-2-arnd@arndb.de>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20180817102645.3839621-2-arnd@arndb.de/","date":"2018-08-17T10:26:31","name":"[RFC,01/15] PCI: clean up legacy host bridge scan functions","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"147a99c1849fc80624563cb30c724d3e7cf1274b","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-2-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/958759/comments/","check":"success","checks":"http://patchwork.ozlabs.org/api/patches/958759/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 [IPv6:2401:3900:2:1::3])\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 41sKjw6n0Rz9s3Z\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 17 Aug 2018 20:50:44 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 41sKjw5SkQzF15Z\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 17 Aug 2018 20:50:44 +1000 (AEST)","from mout.kundenserver.de (mout.kundenserver.de [212.227.17.13])\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 41sKKV74xtzDrb6\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 17 Aug 2018 20:33:02 +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\t0LbrfA-1gFk7r2rG0-00jIgT; Fri, 17 Aug 2018 12:27:15 +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.13; 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"],"From":"Arnd Bergmann <arnd@arndb.de>","To":"linux-pci@vger.kernel.org,\n\tBjorn Helgaas <bhelgaas@google.com>","Subject":"[RFC 01/15] PCI: clean up legacy host bridge scan functions","Date":"Fri, 17 Aug 2018 12:26:31 +0200","Message-Id":"<20180817102645.3839621-2-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:qDqhbuzSX8z08T2QJlMsg/+ruOlcqG1c6ro78J/5MxdL56nnRad\n\tyO5HhKo3efL2siEaAAY7qOiJJ3tKLIqKd6DJd1500VXoRHZnzIU11B5eNkG3bBfbRbiMaOC\n\t7sIxy4pZO0kdRg2lK5a97hD/1JtCLT9+XU9Bhcz8Phl5VVvzt8s/T5OnHN6eXScNldLezo9\n\t2xaQ1mtfde4n2i8BI3gDQ==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:3BVTzKig7xo=:PLgrU7L7PtC8+B3pvfIMPk\n\tqJZkq430xbSgQwNh2d5sekkbnSpC+T//3qhmBwjZBvxEwLiSsm34Y26J6Fe0Bxg2BPEydcocc\n\tNVe6m6I+xPvtqFB1CFXAH/kF6zwuuewlYNBb5f/DLgujFia2xYzFjfs5YH39G5bNERQASdrVG\n\tChwUErAJpTpHMqJEvQZa2hXaTCelXwEfRVOGj6FSLNQ65MGRYvau8q7dYDZ9QQK+7KtDXEjOe\n\tPKlF78LvMdp8OPPUItU3MlcWJOFI03b/X9O3CY90iFle808yxjwoB7Onht9MvwHkiHvf15PPD\n\tq2dyz7YaThSqMNIHYhqSI6nF76fcYYKFcWo1zXyBZwjOUOhJmufYjlCgzJdqctbghySTFpzpr\n\t4KUdAXK8ZC3XSfGaf9go+bMwOzuRqy0HB1rf7/fScw34+NQ6ss8IaXn1dn7/9nCQa61DzV46e\n\ti/mBhjC0J6O/ZdrDCpzOKzCBJTZTzlf67Av/bthglhVNUkh70gxyvUyFJC63+KC+g01cVZVcK\n\tkLbVDGSL+L9n8oRHgY9gnCU5b4C8WroVzGkCT+Ewn7lWTLuU/IiJ0IMmY66T2xxz10QAkWaCe\n\t45ZyXobbwW3Oe5QF4oVQlO9Z8MAIjHRxStnSesQs3nogvblrsMRaiVDkJiOgMHS/ehyzaoyil\n\tFIV2wFNwGepJKW5tZq2DX8DUMHRPQsPvAICCND/zCOKpTInGF4RDQ46YBTKrEU6nKMUU=","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":"Aside from the modern pci_host_bridge based interfaces, we have a couple\nof interfaces from old times that are still used in a couple of platforms:\npci_create_root_bus(), pci_scan_bus() and pci_scan_root_bus().\n\nAs a first step towards getting everybody to use the new interfaces,\nthis simplifies the latter two to call the pci_alloc_host_bridge() and\npci_register_host_bridge()/pci_scan_root_bus_bridge() interfaces directly.\n\nThe behavior should be entirely unchanged here, but we can then push\ndown the functions into the individual host implementations.\n\nSigned-off-by: Arnd Bergmann <arnd@arndb.de>\n---\n drivers/pci/probe.c | 86 ++++++++++++++++++++++++---------------------\n 1 file changed, 45 insertions(+), 41 deletions(-)","diff":"diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c\nindex ec784009a36b..b0f666271245 100644\n--- a/drivers/pci/probe.c\n+++ b/drivers/pci/probe.c\n@@ -23,13 +23,6 @@\n #define CARDBUS_LATENCY_TIMER\t176\t/* secondary latency timer */\n #define CARDBUS_RESERVE_BUSNR\t3\n \n-static struct resource busn_resource = {\n-\t.name\t= \"PCI busn\",\n-\t.start\t= 0,\n-\t.end\t= 255,\n-\t.flags\t= IORESOURCE_BUS,\n-};\n-\n /* Ugh.  Need to stop exporting this to modules. */\n LIST_HEAD(pci_root_buses);\n EXPORT_SYMBOL(pci_root_buses);\n@@ -3060,53 +3053,64 @@ EXPORT_SYMBOL(pci_scan_root_bus_bridge);\n 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 {\n-\tstruct resource_entry *window;\n-\tbool found = false;\n-\tstruct pci_bus *b;\n-\tint max;\n-\n-\tresource_list_for_each_entry(window, resources)\n-\t\tif (window->res->flags & IORESOURCE_BUS) {\n-\t\t\tfound = true;\n-\t\t\tbreak;\n-\t\t}\n+\tstruct pci_host_bridge *bridge;\n+\tint error;\n \n-\tb = pci_create_root_bus(parent, bus, ops, sysdata, resources);\n-\tif (!b)\n+\tbridge = pci_alloc_host_bridge(0);\n+\tif (!bridge)\n \t\treturn NULL;\n \n-\tif (!found) {\n-\t\tdev_info(&b->dev,\n-\t\t \"No busn resource found for root bus, will use [bus %02x-ff]\\n\",\n-\t\t\tbus);\n-\t\tpci_bus_insert_busn_res(b, bus, 255);\n-\t}\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 \n-\tmax = pci_scan_child_bus(b);\n+\terror = pci_scan_root_bus_bridge(bridge);\n+\tif (error < 0)\n+\t\tgoto err_out;\n \n-\tif (!found)\n-\t\tpci_bus_update_busn_res_end(b, max);\n+\treturn bridge->bus;\n \n-\treturn b;\n+err_out:\n+\tkfree(bridge);\n+\treturn NULL;\n }\n EXPORT_SYMBOL(pci_scan_root_bus);\n \n+static struct resource busn_resource = {\n+\t.name\t= \"PCI busn\",\n+\t.start\t= 0,\n+\t.end\t= 255,\n+\t.flags\t= IORESOURCE_BUS,\n+};\n+\n struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,\n \t\t\t\t\tvoid *sysdata)\n {\n-\tLIST_HEAD(resources);\n-\tstruct pci_bus *b;\n+\tstruct pci_host_bridge *bridge;\n+\tint error;\n \n-\tpci_add_resource(&resources, &ioport_resource);\n-\tpci_add_resource(&resources, &iomem_resource);\n-\tpci_add_resource(&resources, &busn_resource);\n-\tb = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);\n-\tif (b) {\n-\t\tpci_scan_child_bus(b);\n-\t} else {\n-\t\tpci_free_resource_list(&resources);\n-\t}\n-\treturn b;\n+\tbridge = pci_alloc_host_bridge(0);\n+\tif (!bridge)\n+\t\tgoto err;\n+\n+\tpci_add_resource(&bridge->windows, &ioport_resource);\n+\tpci_add_resource(&bridge->windows, &iomem_resource);\n+\tpci_add_resource(&bridge->windows, &busn_resource);\n+\tbridge->sysdata = sysdata;\n+\tbridge->busnr = bus;\n+\tbridge->ops = ops;\n+\n+\terror = pci_scan_root_bus_bridge(bridge);\n+\tif (error < 0)\n+\t\tgoto err;\n+\n+\treturn bridge->bus;\n+\n+err:\n+\tpci_free_host_bridge(bridge);\n+\treturn NULL;\n }\n EXPORT_SYMBOL(pci_scan_bus);\n \n","prefixes":["RFC","01/15"]}