Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/958762/?format=api
{ "id": 958762, "url": "http://patchwork.ozlabs.org/api/patches/958762/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20180817102645.3839621-10-arnd@arndb.de/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "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-10-arnd@arndb.de>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20180817102645.3839621-10-arnd@arndb.de/", "date": "2018-08-17T10:26:39", "name": "[RFC,09/15] PCI: xenfront: clean up pcifront_scan_root()", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "4080f1efe147c52d6caa8d7adb28d7f02a4aee30", "submitter": { "id": 30, "url": "http://patchwork.ozlabs.org/api/people/30/?format=api", "name": "Arnd Bergmann", "email": "arnd@arndb.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20180817102645.3839621-10-arnd@arndb.de/mbox/", "series": [ { "id": 61229, "url": "http://patchwork.ozlabs.org/api/series/61229/?format=api", "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/958762/comments/", "check": "success", "checks": "http://patchwork.ozlabs.org/api/patches/958762/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 41sKnw063fz9ryn\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 17 Aug 2018 20:54:12 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 41sKnv5yfTzDr5p\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 17 Aug 2018 20:54:11 +1000 (AEST)", "from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74])\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 41sKKW3zZCzDrHP\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 17 Aug 2018 20:33:03 +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\t0LfAVs-1gEfGg3Ql6-00olnh; 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=217.72.192.74; 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 09/15] PCI: xenfront: clean up pcifront_scan_root()", "Date": "Fri, 17 Aug 2018 12:26:39 +0200", "Message-Id": "<20180817102645.3839621-10-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:imp36udsrO2nyS8JPjqHA5Ds3hFhxVLPHpRGVSWPBGXVbL9/rNV\n\timiE1c81Sfttwp+bT8f8tuK+epvIVP0/tH2n09iCfqvqjLRLlFBwdbr6U+nTVjL+eKbRy82\n\t/29LhtzYPzABNffKaggHUp+zeicohWvtT/S8mD+XO+rHW/DejrjMQq9cGaJyd1HBBEumpqw\n\tplfhY45irAx+gsxE+znig==", "X-UI-Out-Filterresults": "notjunk:1; V01:K0:66KgbqXwaoY=:P/v24nJmghk+b9u5YGEuSj\n\tL9rIV7n62Bc7vJoWNZz6hTXEI984RM8vhiKtFjIcTKl//gHowye519aIoLUsS4E8WUktVzk89\n\t8o+Va+yWc7a3CuQeKkM2u6glYf+oAJeeoDimT1cWN3HGoD0oJG6yLJC6Mp1AOpbb3KZuzGIYa\n\tSyP6TRSa1fiCOqFBfWOr/19B/YBuO9ywza6acDO9Tg3WJOxFMMa7Sx7hkBkWhzs28P8LHDvD8\n\tyQCSrHJUtQJAaO2xa2uL9eQM7xVkc78zWW5Bnfzhb/PwubQsm+Otf3msOPffihr1O0UqXiATf\n\twc8kYjigbpOMUl7dpQUNu83t/pITBUAinMKt0RKrUSECKb7K+FFTWX7lW/zHMzr4ruJaW67CA\n\txPVbvXDP0hWzBapqVIBXSir2LSRwoCX2iDqN7fTfW7gIfFAin4bWR9fLvBrd1RNpJ1HBOwJST\n\tXnr4N2SDUHy8TT+8fAxKT4OB8isAVhJUwPpcINuDGjGwCYqD8CZvuD5QHzx/Cta7k6LMNGGal\n\txLwqx06jxdFzUoeUmWl5Qjzag0pHlblexrRLJsWxMKC9iXtCCkgKwDrIq+qA3vCj7JruLkwba\n\t7jHMQFElxZRF01Ne7Ln6+tF8qf1IHPPIZBkLkA5bcIaaPIduvqojP10mfeGKnVOi9wbm9FPUU\n\ttwunQwIXPau8+zTW30IISEeFLPurGUboLnh6vOgC3rvckEmnfui82Jfa/1KGf/dPqXi8=", "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": "Merging pci_scan_root_bus() into pcifront_scan_root() simplifies\nthe implementation and makes it more readable. We can allocate\nthe pcifront_sd structure along with the bridge structure, which\nhelps manage its lifetime rules so we don't free it before the\ndevice has been released.\n\nThere are two small issues that I noticed that could be improved:\n\n- It seems we unregister the 'bus' device that is a child of the\n 'pci_host_bridge' device after we unregister its parent in\n pcifront_free_roots(), which seems odd.\n- We probably don't need an extra pci_bus_entry list at all,\n but could instead walk the children of the pcifront_device,\n which are all pci_host_bridge devices.\n\nSigned-off-by: Arnd Bergmann <arnd@arndb.de>\n---\n drivers/pci/xen-pcifront.c | 67 ++++++++++++--------------------------\n 1 file changed, 21 insertions(+), 46 deletions(-)", "diff": "diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c\nindex 24070e1c5f22..a5eb6cb02bec 100644\n--- a/drivers/pci/xen-pcifront.c\n+++ b/drivers/pci/xen-pcifront.c\n@@ -443,40 +443,12 @@ static int pcifront_scan_bus(struct pcifront_device *pdev,\n \treturn 0;\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-{\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-\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-\terror = pci_scan_root_bus_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 static int pcifront_scan_root(struct pcifront_device *pdev,\n \t\t\t\t unsigned int domain, unsigned int bus)\n {\n-\tstruct pci_bus *b;\n-\tLIST_HEAD(resources);\n \tstruct pcifront_sd *sd = NULL;\n \tstruct pci_bus_entry *bus_entry = NULL;\n+\tstruct pci_host_bridge *bridge;\n \tint err = 0;\n \tstatic struct resource busn_res = {\n \t\t.start = 0,\n@@ -498,50 +470,55 @@ static int pcifront_scan_root(struct pcifront_device *pdev,\n \tdev_info(&pdev->xdev->dev, \"Creating PCI Frontend Bus %04x:%02x\\n\",\n \t\t domain, bus);\n \n+\tbridge = pci_alloc_host_bridge(sizeof(*sd));\n+\tif (!bridge)\n+\t\treturn -ENOMEM;\n+\n \tbus_entry = kzalloc(sizeof(*bus_entry), GFP_KERNEL);\n-\tsd = kzalloc(sizeof(*sd), GFP_KERNEL);\n-\tif (!bus_entry || !sd) {\n+\tsd = pci_host_bridge_priv(bridge);\n+\tif (!bus_entry) {\n \t\terr = -ENOMEM;\n \t\tgoto err_out;\n \t}\n-\tpci_add_resource(&resources, &ioport_resource);\n-\tpci_add_resource(&resources, &iomem_resource);\n-\tpci_add_resource(&resources, &busn_res);\n+\tpci_add_resource(&bridge->windows, &ioport_resource);\n+\tpci_add_resource(&bridge->windows, &iomem_resource);\n+\tpci_add_resource(&bridge->windows, &busn_res);\n \tpcifront_init_sd(sd, domain, bus, pdev);\n+\tbridge->dev.parent = &pdev->xdev->dev;\n+\tbridge->sysdata = sd;\n+\tbridge->busnr = bus;\n+\tbridge->ops = &pcifront_bus_ops;\n \n \tpci_lock_rescan_remove();\n \n-\tb = pci_scan_root_bus(&pdev->xdev->dev, bus,\n-\t\t\t\t &pcifront_bus_ops, sd, &resources);\n-\tif (!b) {\n+\terr = pci_scan_root_bus_bridge(bridge);\n+\tif (err < 0) {\n \t\tdev_err(&pdev->xdev->dev,\n \t\t\t\"Error creating PCI Frontend Bus!\\n\");\n-\t\terr = -ENOMEM;\n \t\tpci_unlock_rescan_remove();\n-\t\tpci_free_resource_list(&resources);\n \t\tgoto err_out;\n \t}\n \n-\tbus_entry->bus = b;\n+\tbus_entry->bus = bridge->bus;\n \n \tlist_add(&bus_entry->list, &pdev->root_buses);\n \n \t/* pci_scan_root_bus skips devices which do not have a\n \t* devfn==0. The pcifront_scan_bus enumerates all devfn. */\n-\terr = pcifront_scan_bus(pdev, domain, bus, b);\n+\terr = pcifront_scan_bus(pdev, domain, bus, bridge->bus);\n \n \t/* Claim resources before going \"live\" with our devices */\n-\tpci_walk_bus(b, pcifront_claim_resource, pdev);\n+\tpci_walk_bus(bridge->bus, pcifront_claim_resource, pdev);\n \n \t/* Create SysFS and notify udev of the devices. Aka: \"going live\" */\n-\tpci_bus_add_devices(b);\n+\tpci_bus_add_devices(bridge->bus);\n \n \tpci_unlock_rescan_remove();\n \treturn err;\n \n err_out:\n+\tpci_free_host_bridge(bridge);\n \tkfree(bus_entry);\n-\tkfree(sd);\n \n \treturn err;\n }\n@@ -605,8 +582,6 @@ static void pcifront_free_roots(struct pcifront_device *pdev)\n \n \t\tfree_root_bus_devs(bus_entry->bus);\n \n-\t\tkfree(bus_entry->bus->sysdata);\n-\n \t\tdevice_unregister(bus_entry->bus->bridge);\n \t\tpci_remove_bus(bus_entry->bus);\n \n", "prefixes": [ "RFC", "09/15" ] }