get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 804521,
    "url": "http://patchwork.ozlabs.org/api/patches/804521/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1503414919-30820-12-git-send-email-bmeng.cn@gmail.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1503414919-30820-12-git-send-email-bmeng.cn@gmail.com>",
    "list_archive_url": null,
    "date": "2017-08-22T15:15:16",
    "name": "[U-Boot,11/14] nvme: Get rid of the global variable nvme_info",
    "commit_ref": "18aa5a4134e8179c7c3e38675822284a2718a3d8",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "48711a0efbca74d469c66efb471e5ce04d4021cb",
    "submitter": {
        "id": 64981,
        "url": "http://patchwork.ozlabs.org/api/people/64981/?format=api",
        "name": "Bin Meng",
        "email": "bmeng.cn@gmail.com"
    },
    "delegate": {
        "id": 3651,
        "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api",
        "username": "trini",
        "first_name": "Tom",
        "last_name": "Rini",
        "email": "trini@ti.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1503414919-30820-12-git-send-email-bmeng.cn@gmail.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/804521/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/804521/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"RHUAloTW\"; dkim-atps=neutral"
        ],
        "Received": [
            "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xcDc41X82z9sNd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 23 Aug 2017 01:14:12 +1000 (AEST)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid D361FC21C5C; Tue, 22 Aug 2017 15:13:02 +0000 (UTC)",
            "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 6213EC21F34;\n\tTue, 22 Aug 2017 15:11:36 +0000 (UTC)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid 1CD57C21ED8; Tue, 22 Aug 2017 15:11:18 +0000 (UTC)",
            "from mail-io0-f196.google.com (mail-io0-f196.google.com\n\t[209.85.223.196])\n\tby lists.denx.de (Postfix) with ESMTPS id 1020EC21EEB\n\tfor <u-boot@lists.denx.de>; Tue, 22 Aug 2017 15:11:15 +0000 (UTC)",
            "by mail-io0-f196.google.com with SMTP id g71so5207855ioe.5\n\tfor <u-boot@lists.denx.de>; Tue, 22 Aug 2017 08:11:14 -0700 (PDT)",
            "from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com.\n\t[147.11.156.139]) by smtp.gmail.com with ESMTPSA id\n\ta189sm5182572itd.5.2017.08.22.08.11.12\n\t(version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 22 Aug 2017 08:11:12 -0700 (PDT)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:subject:date:message-id:in-reply-to:references;\n\tbh=Jezg4uSBbeWcipUqkrWEF7o7cKxPYjrG4BQQ+lyMYdY=;\n\tb=RHUAloTWyRFplefhpkuj9izvRKtzSG2jerQ7p+sYcq03j7JD6QoGaQ3HK8zcytSz+o\n\tpGifhUa2Ph4M5YrojwXnHUVwapg8dS0chk7rBevY/OlOGn2BOLliBLdONxCiG7a2WOME\n\ttmOg5yLwK/qxppGTOvb3mYKf/g9SZYt6xoc9EW2kAz6a1PZ/AHEkGOv+uEPs8DkhCMLV\n\tQlttIc0GMwyxk6X7iHcFuNg+Y6uWNK2sw8/ncHExcSquAK/Hh0WWbLP35uQ5IvYJIkLt\n\ttY5aABtAh4v97DZGTsiNZy321B9p0ooKziQygVFXsMqZTurzudNzIWyy7yKttF91aeaE\n\tJMeQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=Jezg4uSBbeWcipUqkrWEF7o7cKxPYjrG4BQQ+lyMYdY=;\n\tb=Y56LogxVrThELJR2R8Clq7txVqG0haU5MlbqflJI6v9BEYibnNqW1l0y+euBLCzJJg\n\tLG88QJ7WICGOG8IlGCPZ5eydEy9R+qKLbKOQB+pG8ETX17Ukg2zuuT68bUbZ6Xoz2R5F\n\tg9E0BKANENS7umUUIUa8eCVURGNnkRI3laGIpQlKSjmNk/p4yexPeXxaVz1neEwYLA0h\n\to/oB8bGcSlll/MqmX9xqufZGZRy2nKCKsUFXQ6e1sY7YKOGH4TdyyO9qb1yDtcAYepnu\n\tqcOWQ5kF1uZ7GziCnW9YEqc4bHtPSGJfF2I1XcZoYuiZBVyKW2WfcShHoByC1KyZMMgq\n\t37hQ==",
        "X-Gm-Message-State": "AHYfb5hdmpZ2JRor8sQb+jaiLXhHOecRgLpnZJIadIysgiX4n27gBVvW\n\tfaP5VcMbVKNFXw==",
        "X-Received": "by 10.107.139.131 with SMTP id n125mr817114iod.31.1503414673917; \n\tTue, 22 Aug 2017 08:11:13 -0700 (PDT)",
        "From": "Bin Meng <bmeng.cn@gmail.com>",
        "To": "Tom Rini <trini@konsulko.com>, U-Boot Mailing List <u-boot@lists.denx.de>",
        "Date": "Tue, 22 Aug 2017 08:15:16 -0700",
        "Message-Id": "<1503414919-30820-12-git-send-email-bmeng.cn@gmail.com>",
        "X-Mailer": "git-send-email 1.7.9.5",
        "In-Reply-To": "<1503414919-30820-1-git-send-email-bmeng.cn@gmail.com>",
        "References": "<1503414919-30820-1-git-send-email-bmeng.cn@gmail.com>",
        "Subject": "[U-Boot] [PATCH 11/14] nvme: Get rid of the global variable\n\tnvme_info",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.18",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>"
    },
    "content": "At present the NVMe uclass driver uses a global variable nvme_info\nto store global information like namespace id, and NVMe controller\ndriver's priv struct has a blk_dev_start that is used to calculate\nthe namespace id based on the global information from nvme_info.\n\nThis is not a good design in the DM world and can be replaced with\nthe following changes:\n\n- Encode the namespace id in the NVMe block device name during\n  the NVMe uclass post probe\n- Extract the namespace id from the device name during the NVMe\n  block device probe\n- Let BLK uclass calculate the devnum for us by passing -1 to\n  blk_create_devicef() as the devnum\n\nSigned-off-by: Bin Meng <bmeng.cn@gmail.com>\n---\n\n drivers/nvme/nvme-uclass.c | 27 +++++++--------------------\n drivers/nvme/nvme.c        | 11 +++++------\n drivers/nvme/nvme.h        |  9 ---------\n 3 files changed, 12 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/drivers/nvme/nvme-uclass.c b/drivers/nvme/nvme-uclass.c\nindex 334628c..56a6171 100644\n--- a/drivers/nvme/nvme-uclass.c\n+++ b/drivers/nvme/nvme-uclass.c\n@@ -11,18 +11,6 @@\n #include <dm/device.h>\n #include \"nvme.h\"\n \n-static int nvme_info_init(struct uclass *uc)\n-{\n-\tstruct nvme_info *info = (struct nvme_info *)uc->priv;\n-\n-\tinfo->ns_num = 0;\n-\tinfo->ndev_num = 0;\n-\tINIT_LIST_HEAD(&info->dev_list);\n-\tnvme_info = info;\n-\n-\treturn 0;\n-}\n-\n static int nvme_uclass_post_probe(struct udevice *udev)\n {\n \tchar name[20];\n@@ -32,16 +20,17 @@ static int nvme_uclass_post_probe(struct udevice *udev)\n \n \t/* Create a blk device for each namespace */\n \tfor (i = 0; i < ndev->nn; i++) {\n-\t\tsprintf(name, \"blk#%d\", nvme_info->ns_num);\n+\t\t/*\n+\t\t * Encode the namespace id to the device name so that\n+\t\t * we can extract it when doing the probe.\n+\t\t */\n+\t\tsprintf(name, \"blk#%d\", i);\n \n \t\t/* The real blksz and size will be set by nvme_blk_probe() */\n \t\tret = blk_create_devicef(udev, \"nvme-blk\", name, IF_TYPE_NVME,\n-\t\t\t\t\t nvme_info->ns_num++, 512, 0, &ns_udev);\n-\t\tif (ret) {\n-\t\t\tnvme_info->ns_num--;\n-\n+\t\t\t\t\t -1, 512, 0, &ns_udev);\n+\t\tif (ret)\n \t\t\treturn ret;\n-\t\t}\n \t}\n \n \treturn 0;\n@@ -50,7 +39,5 @@ static int nvme_uclass_post_probe(struct udevice *udev)\n UCLASS_DRIVER(nvme) = {\n \t.name\t= \"nvme\",\n \t.id\t= UCLASS_NVME,\n-\t.init\t= nvme_info_init,\n \t.post_probe = nvme_uclass_post_probe,\n-\t.priv_auto_alloc_size = sizeof(struct nvme_info),\n };\ndiff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c\nindex 67f7d75..ec32d0d 100644\n--- a/drivers/nvme/nvme.c\n+++ b/drivers/nvme/nvme.c\n@@ -13,8 +13,6 @@\n #include <dm/device-internal.h>\n #include \"nvme.h\"\n \n-struct nvme_info *nvme_info;\n-\n #define NVME_Q_DEPTH\t\t2\n #define NVME_AQ_DEPTH\t\t2\n #define NVME_SQ_SIZE(depth)\t(depth * sizeof(struct nvme_command))\n@@ -650,7 +648,8 @@ static int nvme_blk_probe(struct udevice *udev)\n \n \tmemset(ns, 0, sizeof(*ns));\n \tns->dev = ndev;\n-\tns->ns_id = desc->devnum - ndev->blk_dev_start + 1;\n+\t/* extract the namespace id from the block device name */\n+\tns->ns_id = trailing_strtol(udev->name) + 1;\n \tif (nvme_identify(ndev, ns->ns_id, 0, (dma_addr_t)id))\n \t\treturn -EIO;\n \n@@ -762,8 +761,10 @@ U_BOOT_DRIVER(nvme_blk) = {\n \n static int nvme_bind(struct udevice *udev)\n {\n+\tstatic int ndev_num;\n \tchar name[20];\n-\tsprintf(name, \"nvme#%d\", nvme_info->ndev_num++);\n+\n+\tsprintf(name, \"nvme#%d\", ndev_num++);\n \n \treturn device_set_name(udev, name);\n }\n@@ -815,8 +816,6 @@ static int nvme_probe(struct udevice *udev)\n \t\tgoto free_queue;\n \n \tnvme_get_info_from_identify(ndev);\n-\tndev->blk_dev_start = nvme_info->ns_num;\n-\tlist_add(&ndev->node, &nvme_info->dev_list);\n \n \treturn 0;\n \ndiff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h\nindex f0fa639..67bf6e1 100644\n--- a/drivers/nvme/nvme.h\n+++ b/drivers/nvme/nvme.h\n@@ -628,13 +628,6 @@ struct nvme_dev {\n \tu64 *prp_pool;\n \tu32 prp_entry_num;\n \tu32 nn;\n-\tu32 blk_dev_start;\n-};\n-\n-struct nvme_info {\n-\tint ns_num;\t/*the number of nvme namespaces*/\n-\tint ndev_num;\t/*the number of nvme devices*/\n-\tstruct list_head dev_list;\n };\n \n /*\n@@ -652,6 +645,4 @@ struct nvme_ns {\n \tu32 mode_select_block_len;\n };\n \n-extern struct nvme_info *nvme_info;\n-\n #endif /* __DRIVER_NVME_H__ */\n",
    "prefixes": [
        "U-Boot",
        "11/14"
    ]
}