get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1032840,
    "url": "http://patchwork.ozlabs.org/api/patches/1032840/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20190129150143.12681-10-mika.westerberg@linux.intel.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20190129150143.12681-10-mika.westerberg@linux.intel.com>",
    "list_archive_url": null,
    "date": "2019-01-29T15:01:24",
    "name": "[09/28] thunderbolt: Cache adapter specific capability offset into struct port",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "02ac226c6c66ef37e610cf2f9f018125013d9f9c",
    "submitter": {
        "id": 14534,
        "url": "http://patchwork.ozlabs.org/api/people/14534/?format=api",
        "name": "Mika Westerberg",
        "email": "mika.westerberg@linux.intel.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20190129150143.12681-10-mika.westerberg@linux.intel.com/mbox/",
    "series": [
        {
            "id": 88859,
            "url": "http://patchwork.ozlabs.org/api/series/88859/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=88859",
            "date": "2019-01-29T15:01:18",
            "name": "thunderbolt: Software connection manager improvements",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/88859/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1032840/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1032840/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming-netdev@ozlabs.org",
        "Delivered-To": "patchwork-incoming-netdev@ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=linux.intel.com"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 43pqZL2yCHz9sMM\n\tfor <patchwork-incoming-netdev@ozlabs.org>;\n\tWed, 30 Jan 2019 02:06:02 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1728974AbfA2PFo (ORCPT\n\t<rfc822;patchwork-incoming-netdev@ozlabs.org>);\n\tTue, 29 Jan 2019 10:05:44 -0500",
            "from mga12.intel.com ([192.55.52.136]:8099 \"EHLO mga12.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1728186AbfA2PBv (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 29 Jan 2019 10:01:51 -0500",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jan 2019 07:01:50 -0800",
            "from black.fi.intel.com ([10.237.72.28])\n\tby fmsmga006.fm.intel.com with ESMTP; 29 Jan 2019 07:01:48 -0800",
            "by black.fi.intel.com (Postfix, from userid 1001)\n\tid 97136570; Tue, 29 Jan 2019 17:01:44 +0200 (EET)"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.56,537,1539673200\"; d=\"scan'208\";a=\"314531724\"",
        "From": "Mika Westerberg <mika.westerberg@linux.intel.com>",
        "To": "linux-kernel@vger.kernel.org",
        "Cc": "Michael Jamet <michael.jamet@intel.com>,\n\tYehezkel Bernat <YehezkelShB@gmail.com>,\n\tAndreas Noever <andreas.noever@gmail.com>,\n\tLukas Wunner <lukas@wunner.de>, \"David S . Miller\" <davem@davemloft.net>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tAndy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tnetdev@vger.kernel.org",
        "Subject": "[PATCH 09/28] thunderbolt: Cache adapter specific capability offset\n\tinto struct port",
        "Date": "Tue, 29 Jan 2019 18:01:24 +0300",
        "Message-Id": "<20190129150143.12681-10-mika.westerberg@linux.intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190129150143.12681-1-mika.westerberg@linux.intel.com>",
        "References": "<20190129150143.12681-1-mika.westerberg@linux.intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "The adapter specific capability either is there or not if the port does\nnot hold an adapter. Instead of always finding it on-demand we read the\noffset just once when the port is initialized.\n\nWhile there we update the struct port documentation to follow kernel-doc\nformat.\n\nSigned-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>\n---\n drivers/thunderbolt/switch.c     | 4 ++++\n drivers/thunderbolt/tb.c         | 4 ++--\n drivers/thunderbolt/tb.h         | 3 +++\n drivers/thunderbolt/tunnel_pci.c | 9 +++------\n 4 files changed, 12 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c\nindex 1eee2502b5ba..fcafe4095de5 100644\n--- a/drivers/thunderbolt/switch.c\n+++ b/drivers/thunderbolt/switch.c\n@@ -585,6 +585,8 @@ static int tb_init_port(struct tb_port *port)\n \tif (res)\n \t\treturn res;\n \n+\tport->cap_adap = -ENOENT;\n+\n \t/* Port 0 is the switch itself and has no PHY. */\n \tif (port->config.type == TB_TYPE_PORT && port->port != 0) {\n \t\tcap = tb_port_find_cap(port, TB_PORT_CAP_PHY);\n@@ -593,6 +595,8 @@ static int tb_init_port(struct tb_port *port)\n \t\t\tport->cap_phy = cap;\n \t\telse\n \t\t\ttb_port_WARN(port, \"non switch port without a PHY\\n\");\n+\t} else if (port->port != 0) {\n+\t\tport->cap_adap = tb_port_find_cap(port, TB_PORT_CAP_ADAP);\n \t}\n \n \ttb_dump_port(port->sw->tb, &port->config);\ndiff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c\nindex 30e02c716f6c..8e9761d950d6 100644\n--- a/drivers/thunderbolt/tb.c\n+++ b/drivers/thunderbolt/tb.c\n@@ -151,7 +151,7 @@ static struct tb_port *tb_find_unused_down_port(struct tb_switch *sw)\n \t\t\tcontinue;\n \t\tif (sw->ports[i].config.type != TB_TYPE_PCIE_DOWN)\n \t\t\tcontinue;\n-\t\tcap = tb_port_find_cap(&sw->ports[i], TB_PORT_CAP_ADAP);\n+\t\tcap = sw->ports[i].cap_adap;\n \t\tif (cap < 0)\n \t\t\tcontinue;\n \t\tres = tb_port_read(&sw->ports[i], &data, TB_CFG_PORT, cap, 1);\n@@ -197,7 +197,7 @@ static void tb_activate_pcie_devices(struct tb *tb)\n \t\t}\n \n \t\t/* check whether port is already activated */\n-\t\tcap = tb_port_find_cap(up_port, TB_PORT_CAP_ADAP);\n+\t\tcap = up_port->cap_adap;\n \t\tif (cap < 0)\n \t\t\tcontinue;\n \t\tif (tb_port_read(up_port, &data, TB_CFG_PORT, cap, 1))\ndiff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h\nindex 3160169389cc..43a1d7dfba73 100644\n--- a/drivers/thunderbolt/tb.h\n+++ b/drivers/thunderbolt/tb.h\n@@ -124,6 +124,8 @@ struct tb_switch {\n  * @remote: Remote port (%NULL if not connected)\n  * @xdomain: Remote host (%NULL if not connected)\n  * @cap_phy: Offset, zero if not found\n+ * @cap_adap: Offset of the adapter specific capability. Negative if not\n+ *\t      present.\n  * @port: Port number on switch\n  * @disabled: Disabled by eeprom\n  * @dual_link_port: If the switch is connected using two ports, points\n@@ -136,6 +138,7 @@ struct tb_port {\n \tstruct tb_port *remote;\n \tstruct tb_xdomain *xdomain;\n \tint cap_phy;\n+\tint cap_adap;\n \tu8 port;\n \tbool disabled;\n \tstruct tb_port *dual_link_port;\ndiff --git a/drivers/thunderbolt/tunnel_pci.c b/drivers/thunderbolt/tunnel_pci.c\nindex 0637537ea53f..4fae236a4a39 100644\n--- a/drivers/thunderbolt/tunnel_pci.c\n+++ b/drivers/thunderbolt/tunnel_pci.c\n@@ -148,12 +148,9 @@ bool tb_pci_is_invalid(struct tb_pci_tunnel *tunnel)\n static int tb_pci_port_active(struct tb_port *port, bool active)\n {\n \tu32 word = active ? 0x80000000 : 0x0;\n-\tint cap = tb_port_find_cap(port, TB_PORT_CAP_ADAP);\n-\tif (cap < 0) {\n-\t\ttb_port_warn(port, \"TB_PORT_CAP_ADAP not found: %d\\n\", cap);\n-\t\treturn cap;\n-\t}\n-\treturn tb_port_write(port, &word, TB_CFG_PORT, cap, 1);\n+\tif (port->cap_adap < 0)\n+\t\treturn -ENXIO;\n+\treturn tb_port_write(port, &word, TB_CFG_PORT, port->cap_adap, 1);\n }\n \n /**\n",
    "prefixes": [
        "09/28"
    ]
}