{"id":958756,"url":"http://patchwork.ozlabs.org/api/patches/958756/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20180817102645.3839621-11-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-11-arnd@arndb.de>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20180817102645.3839621-11-arnd@arndb.de/","date":"2018-08-17T10:26:40","name":"[RFC,10/15] sparc/PCI: simplify pci_scan_one_pbm","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"9cc5310eba61d68574842b74144b00576409901b","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-11-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/958756/comments/","check":"warning","checks":"http://patchwork.ozlabs.org/api/patches/958756/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 41sKbS34KXz9s3Z\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 17 Aug 2018 20:45:08 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 41sKbS1vKbzF12F\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 17 Aug 2018 20:45:08 +1000 (AEST)","from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10])\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 41sKKP0XfRzF0gL\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 17 Aug 2018 20:32:56 +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\t0MF3Yx-1ffKFY0w9b-00GG86; Fri, 17 Aug 2018 12:27:19 +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.10; 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 10/15] sparc/PCI: simplify pci_scan_one_pbm","Date":"Fri, 17 Aug 2018 12:26:40 +0200","Message-Id":"<20180817102645.3839621-11-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:tqfqrJow5W4imcQdki9mGzYbBLDxofa09sQuKVVmcKPe9NKicQu\n\t8BCFKR5x8HHGblInvnpgfM0Om9m61dXNuEzCIJ49sP//cfH3KTR8BqOqORdz4p1h7JROjqJ\n\tCiXbMgNkdpblfAYzq1OUFR9CqgorJFNPchgd2Qp4LZRLY2gq8SB2mQD0V3AQBL6R9BKkfBV\n\tT5dOLAgJhkzmztez96I5g==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:NwRKKMzv3E8=:QlBuV1sRCJGQm0iC5/TM6k\n\trUiyobUJCUMFNLefA+dKv9cSraIqTCXZATc6YpSdv5MeIiDiXqZrOrbPJLrU0ovVGvoXXGiju\n\tkb2wBbSDra92INnlUuVJjgDGdhFE2KajDetqBPU7hO/klwLL0jcbhAomkZaEY1YyaEfP9ayru\n\tEnXRTxogVL6/XcomoGxt28wyQzgXsopuQMlW4E/0olqJmIuuxAeOWvkYZFxXtdyWSPhg4wdRt\n\tM19d2fUaHKoDOvS9QTsorAKv/1ka30Io+Fm9oi5lupfC7sbB6W0FfGJ61ebw5GeeSUhnHLCsu\n\taNUy9H3s4BYmaLLVMYE2ikiEn7AZoQYuUO32Y8NBr4GMJUKi8tHhRSRRSqfxFpbfjJdxuU3LI\n\tE7ZAVvdh0b6P2kdtTbmCeJC7RWSslaHQV19nUWu02F09EC3lmCt94PRk0ER1cUGinpzc16rv7\n\tYL/BD4XUfyDtUZ32LltOTBsnS4VWU7qg+PFdWnOEEuqH/y1S3Up0Q1J1Rvnt2lOttzFI84qid\n\tUNZMUqV0wGXX7OTTyyrWmSycxkkwGI6D1/Zmm2QIehXpFOz7E9Ze9nDX5HeoXd2WZf8pGpSyg\n\tZHWD1cXUS0theeaux/a2f3lBcc0EdQMmX3YArT7vuICi9Id/Q7M3zj9R9HRzUm7Pv0oNHcDTy\n\tluhOgxKA2KKU7O2tLYOQRjdTUn5M7GacTjCgnaJ3qgb0ltuYKvn6VblZSuNyWc/JctBQ=","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":"We no longer need a separate pci_create_root_bus() function, and\nmerging it into pci_scan_one_pbm() makes the implementation easier\nto understand.\n\nA possible future cleanup would move the allocation of the\npci_host_bridge structure into the callers of pci_scan_one_pbm,\nand avoid duplication between pci_host_bridge and pci_pbm_info\nfields.\n\nSigned-off-by: Arnd Bergmann <arnd@arndb.de>\n---\n arch/sparc/kernel/pci.c | 62 ++++++++++++++---------------------------\n 1 file changed, 21 insertions(+), 41 deletions(-)","diff":"diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c\nindex afbce59d9231..0d34fb2ac55b 100644\n--- a/arch/sparc/kernel/pci.c\n+++ b/arch/sparc/kernel/pci.c\n@@ -691,70 +691,50 @@ static void pci_claim_bus_resources(struct pci_bus *bus)\n \t\tpci_claim_bus_resources(child_bus);\n }\n \n-static struct pci_bus *pci_create_root_bus(struct device *parent, int bus,\n-\t\tstruct pci_ops *ops, void *sysdata, struct list_head *resources)\n+struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,\n+\t\t\t\t struct device *parent)\n {\n-\tint error;\n+\tstruct device_node *node = pbm->op->dev.of_node;\n \tstruct pci_host_bridge *bridge;\n+\tint ret;\n \n \tbridge = pci_alloc_host_bridge(0);\n \tif (!bridge)\n \t\treturn NULL;\n \n \tbridge->dev.parent = parent;\n+\tbridge->sysdata = pbm;\n+\tbridge->busnr = pbm->pci_first_busno;\n+\tbridge->ops = pbm->pci_ops;\n \n-\tlist_splice_init(resources, &bridge->windows);\n-\tbridge->sysdata = sysdata;\n-\tbridge->busnr = bus;\n-\tbridge->ops = ops;\n-\n-\terror = pci_register_host_bridge(bridge);\n-\tif (error < 0)\n-\t\tgoto err_out;\n-\n-\treturn bridge->bus;\n-\n-err_out:\n-\tkfree(bridge);\n-\treturn NULL;\n-}\n-\n-struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,\n-\t\t\t\t struct device *parent)\n-{\n-\tLIST_HEAD(resources);\n-\tstruct device_node *node = pbm->op->dev.of_node;\n-\tstruct pci_bus *bus;\n-\n-\tprintk(\"PCI: Scanning PBM %s\\n\", node->full_name);\n-\n-\tpci_add_resource_offset(&resources, &pbm->io_space,\n+\tpci_add_resource_offset(&bridge->windows, &pbm->io_space,\n \t\t\t\tpbm->io_offset);\n-\tpci_add_resource_offset(&resources, &pbm->mem_space,\n+\tpci_add_resource_offset(&bridge->windows, &pbm->mem_space,\n \t\t\t\tpbm->mem_offset);\n \tif (pbm->mem64_space.flags)\n-\t\tpci_add_resource_offset(&resources, &pbm->mem64_space,\n+\t\tpci_add_resource_offset(&bridge->windows, &pbm->mem64_space,\n \t\t\t\t\tpbm->mem64_offset);\n \tpbm->busn.start = pbm->pci_first_busno;\n \tpbm->busn.end\t= pbm->pci_last_busno;\n \tpbm->busn.flags\t= IORESOURCE_BUS;\n-\tpci_add_resource(&resources, &pbm->busn);\n-\tbus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,\n-\t\t\t\t  pbm, &resources);\n-\tif (!bus) {\n+\tpci_add_resource(&bridge->windows, &pbm->busn);\n+\n+\tprintk(\"PCI: Scanning PBM %s\\n\", node->full_name);\n+\tret = pci_register_host_bridge(bridge);\n+\tif (!ret) {\n \t\tprintk(KERN_ERR \"Failed to create bus for %s\\n\",\n \t\t       node->full_name);\n-\t\tpci_free_resource_list(&resources);\n+\t\tpci_free_host_bridge(bridge);\n \t\treturn NULL;\n \t}\n \n-\tpci_of_scan_bus(pbm, node, bus);\n-\tpci_bus_register_of_sysfs(bus);\n+\tpci_of_scan_bus(pbm, node, bridge->bus);\n+\tpci_bus_register_of_sysfs(bridge->bus);\n \n-\tpci_claim_bus_resources(bus);\n+\tpci_claim_bus_resources(bridge->bus);\n \n-\tpci_bus_add_devices(bus);\n-\treturn bus;\n+\tpci_bus_add_devices(bridge->bus);\n+\treturn bridge->bus;\n }\n \n int pcibios_enable_device(struct pci_dev *dev, int mask)\n","prefixes":["RFC","10/15"]}