get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/813096/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 813096,
    "url": "http://patchwork.ozlabs.org/api/patches/813096/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/23a8b0e3-97ed-e8a1-d54a-cc47294cddd8@linux.vnet.ibm.com/",
    "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": "<23a8b0e3-97ed-e8a1-d54a-cc47294cddd8@linux.vnet.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/23a8b0e3-97ed-e8a1-d54a-cc47294cddd8@linux.vnet.ibm.com/",
    "date": "2017-09-12T21:47:40",
    "name": "[V3,3/4] hotplug/drc-info: Add code to search ibm,drc-info property",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ce8194284d4c98df7d9c958906afb40c71afb619",
    "submitter": {
        "id": 65104,
        "url": "http://patchwork.ozlabs.org/api/people/65104/?format=api",
        "name": "Michael Bringmann",
        "email": "mwb@linux.vnet.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/23a8b0e3-97ed-e8a1-d54a-cc47294cddd8@linux.vnet.ibm.com/mbox/",
    "series": [
        {
            "id": 2781,
            "url": "http://patchwork.ozlabs.org/api/series/2781/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=2781",
            "date": "2017-09-12T21:46:56",
            "name": "powerpc/devtree: Add support for 'ibm,drc-info' property",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/2781/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/813096/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813096/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 3xsJSn5LNGz9t33\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 13 Sep 2017 07:53:13 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xsJSn4GrzzDrZx\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 13 Sep 2017 07:53:13 +1000 (AEST)",
            "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xsJLV0vwCzDrJc\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 13 Sep 2017 07:47:45 +1000 (AEST)",
            "from pps.filterd (m0098393.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8CLhvvk091629\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 12 Sep 2017 17:47:44 -0400",
            "from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cxhmt2rk1-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 12 Sep 2017 17:47:44 -0400",
            "from localhost\n\tby e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from <mwb@linux.vnet.ibm.com>;\n\tTue, 12 Sep 2017 15:47:43 -0600",
            "from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16)\n\tby e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tTue, 12 Sep 2017 15:47:41 -0600",
            "from b03ledav005.gho.boulder.ibm.com\n\t(b03ledav005.gho.boulder.ibm.com [9.17.130.236])\n\tby b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v8CLlfWm8192386; Tue, 12 Sep 2017 14:47:41 -0700",
            "from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id F33E6BE03B;\n\tTue, 12 Sep 2017 15:47:40 -0600 (MDT)",
            "from oc1554177480.ibm.com (unknown [9.53.92.230])\n\tby b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP id A738ABE039;\n\tTue, 12 Sep 2017 15:47:40 -0600 (MDT)"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com\n\t(client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n\tenvelope-from=mwb@linux.vnet.ibm.com; receiver=<UNKNOWN>)",
        "To": "linuxppc-dev@lists.ozlabs.org",
        "From": "Michael Bringmann <mwb@linux.vnet.ibm.com>",
        "Subject": "[PATCH V3 3/4] hotplug/drc-info: Add code to search ibm,drc-info\n\tproperty",
        "Organization": "IBM Linux Technology Center",
        "In-Reply-To": "<531bfd59-97ed-0ea9-0a93-dea7eb415b77@linux.vnet.ibm.com>",
        "Date": "Tue, 12 Sep 2017 16:47:40 -0500",
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.0",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Language": "en-US",
        "Content-Transfer-Encoding": "8bit",
        "X-TM-AS-GCONF": "00",
        "x-cbid": "17091221-0020-0000-0000-00000CB33B95",
        "X-IBM-SpamModules-Scores": "",
        "X-IBM-SpamModules-Versions": "BY=3.00007714; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000227; SDB=6.00916119; UDB=6.00460009;\n\tIPR=6.00696351; \n\tBA=6.00005587; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017130;\n\tXFM=3.00000015; UTC=2017-09-12 21:47:42",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "17091221-0021-0000-0000-00005E1AEB80",
        "Message-Id": "<23a8b0e3-97ed-e8a1-d54a-cc47294cddd8@linux.vnet.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-12_09:, , signatures=0",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=1\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709120307",
        "X-BeenThere": "linuxppc-dev@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.24",
        "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": "nfont@linux.vnet.ibm.com,\n\tMichael Bringmann from Kernel Team <mbringm@us.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": "rpadlpar_core.c: Provide parallel routines to search the older device-\ntree properties (\"ibm,drc-indexes\", \"ibm,drc-names\", \"ibm,drc-types\"\nand \"ibm,drc-power-domains\"), or the new property \"ibm,drc-info\".\n\nThe interface to examine the DRC information is changed from a \"get\"\nfunction that returns values for local verification elsewhere, to a\n\"check\" function that validates the 'name' and/or 'type' of a device\nnode.  This update hides the format of the underlying device-tree\nproperties, and concentrates the value checks into a single function\nwithout requiring the user to verify whether a search was successful.\n\nSigned-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>\n---\nChanges in V3:\n  -- Some code compression and passing values by structure\n---\n drivers/pci/hotplug/rpadlpar_core.c |   13 ++--\n drivers/pci/hotplug/rpaphp.h        |    4 +\n drivers/pci/hotplug/rpaphp_core.c   |  110 +++++++++++++++++++++++++++--------\n 3 files changed, 92 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c\nindex 3f93a4e..e6924de 100644\n--- a/drivers/pci/hotplug/rpadlpar_core.c\n+++ b/drivers/pci/hotplug/rpadlpar_core.c\n@@ -27,6 +27,7 @@\n #include <linux/mutex.h>\n #include <asm/rtas.h>\n #include <asm/vio.h>\n+#include <linux/firmware.h>\n \n #include \"../pci.h\"\n #include \"rpaphp.h\"\n@@ -44,15 +45,14 @@ static struct device_node *find_vio_slot_node(char *drc_name)\n {\n \tstruct device_node *parent = of_find_node_by_name(NULL, \"vdevice\");\n \tstruct device_node *dn = NULL;\n-\tchar *name;\n \tint rc;\n \n \tif (!parent)\n \t\treturn NULL;\n \n \twhile ((dn = of_get_next_child(parent, dn))) {\n-\t\trc = rpaphp_get_drc_props(dn, NULL, &name, NULL, NULL);\n-\t\tif ((rc == 0) && (!strcmp(drc_name, name)))\n+\t\trc = rpaphp_check_drc_props(dn, drc_name, NULL);\n+\t\tif (rc == 0)\n \t\t\tbreak;\n \t}\n \n@@ -64,15 +64,12 @@ static struct device_node *find_php_slot_pci_node(char *drc_name,\n \t\t\t\t\t\t  char *drc_type)\n {\n \tstruct device_node *np = NULL;\n-\tchar *name;\n-\tchar *type;\n \tint rc;\n \n \twhile ((np = of_find_node_by_name(np, \"pci\"))) {\n-\t\trc = rpaphp_get_drc_props(np, NULL, &name, &type, NULL);\n+\t\trc = rpaphp_check_drc_props(np, drc_name, drc_type);\n \t\tif (rc == 0)\n-\t\t\tif (!strcmp(drc_name, name) && !strcmp(drc_type, type))\n-\t\t\t\tbreak;\n+\t\t\tbreak;\n \t}\n \n \treturn np;\ndiff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h\nindex 7db024e..8db5f2e 100644\n--- a/drivers/pci/hotplug/rpaphp.h\n+++ b/drivers/pci/hotplug/rpaphp.h\n@@ -91,8 +91,8 @@ struct slot {\n \n /* rpaphp_core.c */\n int rpaphp_add_slot(struct device_node *dn);\n-int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,\n-\t\tchar **drc_name, char **drc_type, int *drc_power_domain);\n+int rpaphp_check_drc_props(struct device_node *dn, char *drc_name,\n+\t\tchar *drc_type);\n \n /* rpaphp_slot.c */\n void dealloc_slot_struct(struct slot *slot);\ndiff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c\nindex 8d13202..0587dd4 100644\n--- a/drivers/pci/hotplug/rpaphp_core.c\n+++ b/drivers/pci/hotplug/rpaphp_core.c\n@@ -30,6 +30,7 @@\n #include <linux/smp.h>\n #include <linux/init.h>\n #include <linux/vmalloc.h>\n+#include <asm/firmware.h>\n #include <asm/eeh.h>       /* for eeh_add_device() */\n #include <asm/rtas.h>\t\t/* rtas_call */\n #include <asm/pci-bridge.h>\t/* for pci_controller */\n@@ -196,25 +197,21 @@ static int get_children_props(struct device_node *dn, const int **drc_indexes,\n \treturn 0;\n }\n \n-/* To get the DRC props describing the current node, first obtain it's\n- * my-drc-index property.  Next obtain the DRC list from it's parent.  Use\n- * the my-drc-index for correlation, and obtain the requested properties.\n+\n+/* Verify the existence of 'drc_name' and/or 'drc_type' within the\n+ * current node.  First obtain it's my-drc-index property.  Next,\n+ * obtain the DRC info from it's parent.  Use the my-drc-index for\n+ * correlation, and obtain/validate the requested properties.\n  */\n-int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,\n-\t\tchar **drc_name, char **drc_type, int *drc_power_domain)\n+\n+static int rpaphp_check_drc_props_v1(struct device_node *dn, char *drc_name,\n+\t\t\t\tchar *drc_type, unsigned int my_index)\n {\n+\tchar *name_tmp, *type_tmp;\n \tconst int *indexes, *names;\n \tconst int *types, *domains;\n-\tconst unsigned int *my_index;\n-\tchar *name_tmp, *type_tmp;\n \tint i, rc;\n \n-\tmy_index = of_get_property(dn, \"ibm,my-drc-index\", NULL);\n-\tif (!my_index) {\n-\t\t/* Node isn't DLPAR/hotplug capable */\n-\t\treturn -EINVAL;\n-\t}\n-\n \trc = get_children_props(dn->parent, &indexes, &names, &types, &domains);\n \tif (rc < 0) {\n \t\treturn -EINVAL;\n@@ -225,24 +222,87 @@ int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,\n \n \t/* Iterate through parent properties, looking for my-drc-index */\n \tfor (i = 0; i < be32_to_cpu(indexes[0]); i++) {\n-\t\tif ((unsigned int) indexes[i + 1] == *my_index) {\n-\t\t\tif (drc_name)\n-\t\t\t\t*drc_name = name_tmp;\n-\t\t\tif (drc_type)\n-\t\t\t\t*drc_type = type_tmp;\n-\t\t\tif (drc_index)\n-\t\t\t\t*drc_index = be32_to_cpu(*my_index);\n-\t\t\tif (drc_power_domain)\n-\t\t\t\t*drc_power_domain = be32_to_cpu(domains[i+1]);\n-\t\t\treturn 0;\n-\t\t}\n+\t\tif ((unsigned int) indexes[i + 1] == my_index)\n+\t\t\tbreak;\n+\n \t\tname_tmp += (strlen(name_tmp) + 1);\n \t\ttype_tmp += (strlen(type_tmp) + 1);\n \t}\n \n+\tif (((drc_name == NULL) || (drc_name && !strcmp(drc_name, name_tmp))) &&\n+\t    ((drc_type == NULL) || (drc_type && !strcmp(drc_type, type_tmp))))\n+\t\treturn 0;\n+\n+\treturn -EINVAL;\n+}\n+\n+static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,\n+\t\t\t\tchar *drc_type, unsigned int my_index)\n+{\n+\tstruct property *info;\n+\tunsigned int entries;\n+\tstruct of_drc_info drc;\n+\tvoid *value;\n+\tint j;\n+\n+\tinfo = of_find_property(dn->parent, \"ibm,drc-info\", NULL);\n+\tif (info == NULL)\n+\t\treturn -EINVAL;\n+\n+\tvalue = info->value;\n+\tvalue = (void *)of_prop_next_u32(info, value, &entries);\n+\tif (!value)\n+\t\treturn -EINVAL;\n+\n+\tfor (j = 0; j < entries; j++) {\n+\t\tof_one_drc_info(&info, &value, &drc);\n+\n+\t\t/* Should now know end of current entry */\n+\n+\t\tWARN_ON((my_index < drc.drc_index_start) ||\n+\t\t\t(((my_index-drc.drc_index_start)%\n+\t\t\t\tdrc.sequential_inc) != 0));\n+\n+\t\tif (my_index > drc.last_drc_index)\n+\t\t\tcontinue;\n+\n+\t\tbreak;\n+\t}\n+\t/* Found it */\n+\n+\tif (((drc_name == NULL) ||\n+\t     (drc_name && !strncmp(drc_name,\n+\t\t\t\tdrc.drc_name_prefix,\n+\t\t\t\tstrlen(drc.drc_name_prefix)))) &&\n+\t    ((drc_type == NULL) ||\n+\t     (drc_type && !strncmp(drc_type,\n+\t\t\t\tdrc.drc_type,\n+\t\t\t\tstrlen(drc.drc_type)))))\n+\t\treturn 0;\n+\n \treturn -EINVAL;\n }\n-EXPORT_SYMBOL_GPL(rpaphp_get_drc_props);\n+\n+int rpaphp_check_drc_props(struct device_node *dn, char *drc_name,\n+\t\t\tchar *drc_type)\n+{\n+\tconst unsigned int *my_index;\n+\n+\tmy_index = of_get_property(dn, \"ibm,my-drc-index\", NULL);\n+\tif (!my_index) {\n+\t\t/* Node isn't DLPAR/hotplug capable */\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (firmware_has_feature(FW_FEATURE_DRC_INFO))\n+\t\treturn rpaphp_check_drc_props_v2(dn, drc_name, drc_type,\n+\t\t\t\t\t\t*my_index);\n+\telse\n+\t\treturn rpaphp_check_drc_props_v1(dn, drc_name, drc_type,\n+\t\t\t\t\t\t*my_index);\n+}\n+EXPORT_SYMBOL_GPL(rpaphp_check_drc_props);\n+\n \n static int is_php_type(char *drc_type)\n {\n",
    "prefixes": [
        "V3",
        "3/4"
    ]
}