Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806994/?format=api
{ "id": 806994, "url": "http://patchwork.ozlabs.org/api/patches/806994/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170829073404.8885-3-aik@ozlabs.ru/", "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": "<20170829073404.8885-3-aik@ozlabs.ru>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170829073404.8885-3-aik@ozlabs.ru/", "date": "2017-08-29T07:34:00", "name": "[kernel,v2,2/6] powerpc/eeh: Reduce to one the number of places where edev is allocated", "commit_ref": "8bae6a23198defc5576e4c6f1f97822883d705ae", "pull_url": null, "state": "accepted", "archived": false, "hash": "7b278c632f01c7330447b4f91f4d7cb6a603163b", "submitter": { "id": 7621, "url": "http://patchwork.ozlabs.org/api/people/7621/?format=api", "name": "Alexey Kardashevskiy", "email": "aik@ozlabs.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170829073404.8885-3-aik@ozlabs.ru/mbox/", "series": [ { "id": 322, "url": "http://patchwork.ozlabs.org/api/series/322/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=322", "date": "2017-08-29T07:34:01", "name": "powerpc/eeh: Some cleanups", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/322/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806994/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806994/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 [103.22.144.68])\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 3xhLFd5rwnz9s83\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 17:42:29 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhLFd4XN2zDrSs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 17:42:29 +1000 (AEST)", "from ozlabs.ru (ozlabs.ru [107.173.13.209])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhL4f14s6zDqXk\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 29 Aug 2017 17:34:42 +1000 (AEST)", "from vpl1.ozlabs.ibm.com (localhost [IPv6:::1])\n\tby ozlabs.ru (Postfix) with ESMTP id 568183A6004A;\n\tTue, 29 Aug 2017 03:35:18 -0400 (EDT)" ], "From": "Alexey Kardashevskiy <aik@ozlabs.ru>", "To": "linuxppc-dev@lists.ozlabs.org", "Subject": "[PATCH kernel v2 2/6] powerpc/eeh: Reduce to one the number of\n\tplaces where edev is allocated", "Date": "Tue, 29 Aug 2017 17:34:00 +1000", "Message-Id": "<20170829073404.8885-3-aik@ozlabs.ru>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170829073404.8885-1-aik@ozlabs.ru>", "References": "<20170829073404.8885-1-aik@ozlabs.ru>", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.23", "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": "Alexey Kardashevskiy <aik@ozlabs.ru>,\n\tAndrew Donnellan <andrew.donnellan@au1.ibm.com>", "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": "arch/powerpc/kernel/eeh_dev.c:57 is the only legit place where edev\nis allocated; other 2 places allocate it on stack and in the heap for\na very short period of time to use eeh_pe_get() as takes edev.\n\nThis changes eeh_pe_get() to receive required parameters explicitly.\n\nThis removes unnecessary temporary allocation of edev.\n\nThis uses the \"pe_no\" name instead of the \"pe_config_addr\" name as\nit actually is a PE number and not a config space address as it seemed.\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\nReviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>\nAcked-by: Russell Currey <ruscur@russell.cc>\n---\n arch/powerpc/include/asm/eeh.h | 3 ++-\n arch/powerpc/kernel/eeh_pe.c | 32 ++++++++++++++++++----------\n arch/powerpc/platforms/powernv/eeh-powernv.c | 15 ++-----------\n 3 files changed, 25 insertions(+), 25 deletions(-)", "diff": "diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h\nindex 8e37b71674f4..26a6a43f8799 100644\n--- a/arch/powerpc/include/asm/eeh.h\n+++ b/arch/powerpc/include/asm/eeh.h\n@@ -262,7 +262,8 @@ typedef void *(*eeh_traverse_func)(void *data, void *flag);\n void eeh_set_pe_aux_size(int size);\n int eeh_phb_pe_create(struct pci_controller *phb);\n struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb);\n-struct eeh_pe *eeh_pe_get(struct eeh_dev *edev);\n+struct eeh_pe *eeh_pe_get(struct pci_controller *phb,\n+\t\t\t int pe_no, int config_addr);\n int eeh_add_to_parent_pe(struct eeh_dev *edev);\n int eeh_rmv_from_parent_pe(struct eeh_dev *edev);\n void eeh_pe_update_time_stamp(struct eeh_pe *pe);\ndiff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c\nindex cc4b206f77e4..84d79f3da7d6 100644\n--- a/arch/powerpc/kernel/eeh_pe.c\n+++ b/arch/powerpc/kernel/eeh_pe.c\n@@ -230,10 +230,15 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root,\n * Bus/Device/Function number. The extra data referred by flag\n * indicates which type of address should be used.\n */\n+struct eeh_pe_get_flag {\n+\tint pe_no;\n+\tint config_addr;\n+};\n+\n static void *__eeh_pe_get(void *data, void *flag)\n {\n \tstruct eeh_pe *pe = (struct eeh_pe *)data;\n-\tstruct eeh_dev *edev = (struct eeh_dev *)flag;\n+\tstruct eeh_pe_get_flag *tmp = (struct eeh_pe_get_flag *) flag;\n \n \t/* Unexpected PHB PE */\n \tif (pe->type & EEH_PE_PHB)\n@@ -244,17 +249,17 @@ static void *__eeh_pe_get(void *data, void *flag)\n \t * have non-zero PE address\n \t */\n \tif (eeh_has_flag(EEH_VALID_PE_ZERO)) {\n-\t\tif (edev->pe_config_addr == pe->addr)\n+\t\tif (tmp->pe_no == pe->addr)\n \t\t\treturn pe;\n \t} else {\n-\t\tif (edev->pe_config_addr &&\n-\t\t (edev->pe_config_addr == pe->addr))\n+\t\tif (tmp->pe_no &&\n+\t\t (tmp->pe_no == pe->addr))\n \t\t\treturn pe;\n \t}\n \n \t/* Try BDF address */\n-\tif (edev->config_addr &&\n-\t (edev->config_addr == pe->config_addr))\n+\tif (tmp->config_addr &&\n+\t (tmp->config_addr == pe->config_addr))\n \t\treturn pe;\n \n \treturn NULL;\n@@ -262,7 +267,9 @@ static void *__eeh_pe_get(void *data, void *flag)\n \n /**\n * eeh_pe_get - Search PE based on the given address\n- * @edev: EEH device\n+ * @phb: PCI controller\n+ * @pe_no: PE number\n+ * @config_addr: Config address\n *\n * Search the corresponding PE based on the specified address which\n * is included in the eeh device. The function is used to check if\n@@ -271,12 +278,14 @@ static void *__eeh_pe_get(void *data, void *flag)\n * which is composed of PCI bus/device/function number, or unified\n * PE address.\n */\n-struct eeh_pe *eeh_pe_get(struct eeh_dev *edev)\n+struct eeh_pe *eeh_pe_get(struct pci_controller *phb,\n+\t\tint pe_no, int config_addr)\n {\n-\tstruct eeh_pe *root = eeh_phb_pe_get(edev->phb);\n+\tstruct eeh_pe *root = eeh_phb_pe_get(phb);\n+\tstruct eeh_pe_get_flag tmp = { pe_no, config_addr };\n \tstruct eeh_pe *pe;\n \n-\tpe = eeh_pe_traverse(root, __eeh_pe_get, edev);\n+\tpe = eeh_pe_traverse(root, __eeh_pe_get, &tmp);\n \n \treturn pe;\n }\n@@ -344,7 +353,8 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)\n \t * PE should be composed of PCI bus and its subordinate\n \t * components.\n \t */\n-\tpe = eeh_pe_get(edev);\n+\tpe = eeh_pe_get(edev->pdn->phb, edev->pe_config_addr,\n+\t\t\tedev->config_addr);\n \tif (pe && !(pe->type & EEH_PE_INVALID)) {\n \t\t/* Mark the PE as type of PCI bus */\n \t\tpe->type = EEH_PE_BUS;\ndiff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c\nindex 3f48f6df1cf3..ac8c01cd251c 100644\n--- a/arch/powerpc/platforms/powernv/eeh-powernv.c\n+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c\n@@ -113,7 +113,6 @@ static ssize_t pnv_eeh_ei_write(struct file *filp,\n \t\t\t\tsize_t count, loff_t *ppos)\n {\n \tstruct pci_controller *hose = filp->private_data;\n-\tstruct eeh_dev *edev;\n \tstruct eeh_pe *pe;\n \tint pe_no, type, func;\n \tunsigned long addr, mask;\n@@ -135,13 +134,7 @@ static ssize_t pnv_eeh_ei_write(struct file *filp,\n \t\treturn -EINVAL;\n \n \t/* Retrieve PE */\n-\tedev = kzalloc(sizeof(*edev), GFP_KERNEL);\n-\tif (!edev)\n-\t\treturn -ENOMEM;\n-\tedev->phb = hose;\n-\tedev->pe_config_addr = pe_no;\n-\tpe = eeh_pe_get(edev);\n-\tkfree(edev);\n+\tpe = eeh_pe_get(hose, pe_no, 0);\n \tif (!pe)\n \t\treturn -ENODEV;\n \n@@ -1381,7 +1374,6 @@ static int pnv_eeh_get_pe(struct pci_controller *hose,\n \tstruct pnv_phb *phb = hose->private_data;\n \tstruct pnv_ioda_pe *pnv_pe;\n \tstruct eeh_pe *dev_pe;\n-\tstruct eeh_dev edev;\n \n \t/*\n \t * If PHB supports compound PE, to fetch\n@@ -1397,10 +1389,7 @@ static int pnv_eeh_get_pe(struct pci_controller *hose,\n \t}\n \n \t/* Find the PE according to PE# */\n-\tmemset(&edev, 0, sizeof(struct eeh_dev));\n-\tedev.phb = hose;\n-\tedev.pe_config_addr = pe_no;\n-\tdev_pe = eeh_pe_get(&edev);\n+\tdev_pe = eeh_pe_get(hose, pe_no, 0);\n \tif (!dev_pe)\n \t\treturn -EEXIST;\n \n", "prefixes": [ "kernel", "v2", "2/6" ] }