get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2233018,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233018/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20260505142547.795054-8-johan@kernel.org/",
    "project": {
        "id": 35,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/35/?format=api",
        "name": "Linux I2C development",
        "link_name": "linux-i2c",
        "list_id": "linux-i2c.vger.kernel.org",
        "list_email": "linux-i2c@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260505142547.795054-8-johan@kernel.org>",
    "list_archive_url": null,
    "date": "2026-05-05T14:25:46",
    "name": "[7/8] i2c: core: clean up bus id allocation",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9f120d9bc17b606ac56fced8fc2028c43fd12d12",
    "submitter": {
        "id": 64666,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/64666/?format=api",
        "name": "Johan Hovold",
        "email": "johan@kernel.org"
    },
    "delegate": {
        "id": 9049,
        "url": "http://patchwork.ozlabs.org/api/1.2/users/9049/?format=api",
        "username": "wsa",
        "first_name": "Wolfram",
        "last_name": "Sang",
        "email": "wolfram@the-dreams.de"
    },
    "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20260505142547.795054-8-johan@kernel.org/mbox/",
    "series": [
        {
            "id": 502847,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/502847/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=502847",
            "date": "2026-05-05T14:25:43",
            "name": "i2c: core: adapter registration fixes",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/502847/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2233018/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2233018/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-i2c+bounces-17251-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-i2c@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=popbY3aw;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-i2c+bounces-17251-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"popbY3aw\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"
        ],
        "Received": [
            "from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g91HG2FFqz1yJx\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 00:34:18 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id DA78A305814E\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  5 May 2026 14:28:38 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id ECEFA480942;\n\tTue,  5 May 2026 14:28:34 +0000 (UTC)",
            "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 8617147ECDE;\n\tTue,  5 May 2026 14:28:34 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 62C07C2BCF4;\n\tTue,  5 May 2026 14:28:34 +0000 (UTC)",
            "from johan by xi.lan with local (Exim 4.98.2)\n\t(envelope-from <johan@kernel.org>)\n\tid 1wKGlE-00000003Kt4-0eK8;\n\tTue, 05 May 2026 16:28:32 +0200"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777991314; cv=none;\n b=EnSaYD/72eXS4XaUvBIl64AM3HQ/tyTRr6sCCFXHv0FsYvjBuQPN7g8GixxPoxMVzhNcrS6vPeaeZ+RTr6jxJ0VYg32Xf0GryxKPiEZj0EA01IMLmVt5DmxKxmRVUbDkJLdHmzqs0GpyR+ZQSBQOaP7ao+eQf3v1WWFIJSh/+EM=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777991314; c=relaxed/simple;\n\tbh=9aXxsI+Rl2pPh1JIk3bkX/A2Wgl7wg0KK8314jzIqU4=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Cf8QGxk27WcLYS/p4fqHbFpFHmHbo11AZoxrEe3VHMmVs2daLafruzeUxNF1XLakwhKEiNeTzaIq8JnXKVz8H7hRsv6DEx4Y6NQnLqmlRsKCuZP0dZnXzWqeZzWVs7SOu05IYYFB+LavN9bN4rBGwga/iJ9PeEvThxT20rd/dfM=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=popbY3aw; arc=none smtp.client-ip=10.30.226.201",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777991314;\n\tbh=9aXxsI+Rl2pPh1JIk3bkX/A2Wgl7wg0KK8314jzIqU4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=popbY3awU5oosZPRO9B52awnLROk3qx+926UKrFKwe0swX6kuNWBn9x9hV4xOABJY\n\t LfPQES7PlumFPuA8myj+TXBts7SgnRWafL7ZWy0IyULwN8JQOajNgJZBiCwPrhSU7y\n\t zdfH+7iwr9FIP7cHQO4jDoRtaMGlm27VHnbQPOjnf7YpY3ahKA4fNQZIopK8N1rveu\n\t Pr0teqPCX/lDnvVaen96X+Tj1EBUnIqn5jw502N6CqhtFQ7ocRpC4vNaIJDFHd34L3\n\t 4TbO6fFN3tqmypr/w5NzREMlMk/uRAzsZbjdidI8LdnZMPle9SBP8G8jlotAQnAkj2\n\t vnLdmc1Rxts/A==",
        "From": "Johan Hovold <johan@kernel.org>",
        "To": "Wolfram Sang <wsa+renesas@sang-engineering.com>",
        "Cc": "Andi Shyti <andi.shyti@kernel.org>,\n\tlinux-i2c@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tJohan Hovold <johan@kernel.org>",
        "Subject": "[PATCH 7/8] i2c: core: clean up bus id allocation",
        "Date": "Tue,  5 May 2026 16:25:46 +0200",
        "Message-ID": "<20260505142547.795054-8-johan@kernel.org>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260505142547.795054-1-johan@kernel.org>",
        "References": "<20260505142547.795054-1-johan@kernel.org>",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-i2c@vger.kernel.org",
        "List-Id": "<linux-i2c.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-i2c+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-i2c+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit"
    },
    "content": "Clean up bus id allocation by using a common helper and deferring it\nuntil it is needed during adapter registration.\n\nSigned-off-by: Johan Hovold <johan@kernel.org>\n---\n drivers/i2c/i2c-core-base.c | 86 ++++++++++++++++++-------------------\n 1 file changed, 42 insertions(+), 44 deletions(-)",
    "diff": "diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c\nindex 6209c5587e99..27cd9ca0ae81 100644\n--- a/drivers/i2c/i2c-core-base.c\n+++ b/drivers/i2c/i2c-core-base.c\n@@ -1517,23 +1517,48 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr)\n }\n EXPORT_SYMBOL_GPL(i2c_handle_smbus_host_notify);\n \n+static int i2c_allocate_adapter_id(struct i2c_adapter *adap)\n+{\n+\tint id, start, end;\n+\n+\tif (adap->nr == -1) {\n+\t\tstart = __i2c_first_dynamic_bus_num;\n+\t\tend = 0;\n+\t} else {\n+\t\tstart = adap->nr;\n+\t\tend = adap->nr + 1;\n+\t}\n+\n+\tmutex_lock(&core_lock);\n+\tid = idr_alloc(&i2c_adapter_idr, NULL, start, end, GFP_KERNEL);\n+\tmutex_unlock(&core_lock);\n+\tif (id < 0) {\n+\t\tif (adap->nr != -1 && id == -ENOSPC)\n+\t\t\tid = -EBUSY;\n+\t\tpr_err(\"adapter '%s': failed to allocate id: %d\\n\", adap->name, id);\n+\t\treturn id;\n+\t}\n+\n+\tadap->nr = id;\n+\n+\treturn 0;\n+}\n+\n static int i2c_register_adapter(struct i2c_adapter *adap)\n {\n-\tint res = -EINVAL;\n+\tint res;\n \n \t/* Can't register until after driver model init */\n-\tif (WARN_ON(!is_registered)) {\n-\t\tres = -EAGAIN;\n-\t\tgoto out_list;\n-\t}\n+\tif (WARN_ON(!is_registered))\n+\t\treturn -EAGAIN;\n \n \t/* Sanity checks */\n \tif (WARN(!adap->name[0], \"i2c adapter has no name\"))\n-\t\tgoto out_list;\n+\t\treturn -EINVAL;\n \n \tif (!adap->algo) {\n \t\tpr_err(\"adapter '%s': no algo supplied!\\n\", adap->name);\n-\t\tgoto out_list;\n+\t\treturn -EINVAL;\n \t}\n \n \tif (!adap->lock_ops)\n@@ -1554,9 +1579,13 @@ static int i2c_register_adapter(struct i2c_adapter *adap)\n \tif (res) {\n \t\tpr_err(\"adapter '%s': can't create Host Notify IRQs (%d)\\n\",\n \t\t       adap->name, res);\n-\t\tgoto out_list;\n+\t\treturn res;\n \t}\n \n+\tres = i2c_allocate_adapter_id(adap);\n+\tif (res)\n+\t\treturn res;\n+\n \tdev_set_name(&adap->dev, \"i2c-%d\", adap->nr);\n \tadap->dev.bus = &i2c_bus_type;\n \tadap->dev.type = &i2c_adapter_type;\n@@ -1618,31 +1647,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)\n \tinit_completion(&adap->dev_released);\n \tput_device(&adap->dev);\n \twait_for_completion(&adap->dev_released);\n-out_list:\n-\tmutex_lock(&core_lock);\n-\tidr_remove(&i2c_adapter_idr, adap->nr);\n-\tmutex_unlock(&core_lock);\n-\treturn res;\n-}\n-\n-/**\n- * __i2c_add_numbered_adapter - i2c_add_numbered_adapter where nr is never -1\n- * @adap: the adapter to register (with adap->nr initialized)\n- * Context: can sleep\n- *\n- * See i2c_add_numbered_adapter() for details.\n- */\n-static int __i2c_add_numbered_adapter(struct i2c_adapter *adap)\n-{\n-\tint id;\n \n \tmutex_lock(&core_lock);\n-\tid = idr_alloc(&i2c_adapter_idr, NULL, adap->nr, adap->nr + 1, GFP_KERNEL);\n+\tidr_remove(&i2c_adapter_idr, adap->nr);\n \tmutex_unlock(&core_lock);\n-\tif (WARN(id < 0, \"couldn't get idr\"))\n-\t\treturn id == -ENOSPC ? -EBUSY : id;\n \n-\treturn i2c_register_adapter(adap);\n+\treturn res;\n }\n \n /**\n@@ -1665,17 +1675,8 @@ int i2c_add_adapter(struct i2c_adapter *adapter)\n \tint id;\n \n \tid = of_alias_get_id(dev->of_node, \"i2c\");\n-\tif (id >= 0) {\n-\t\tadapter->nr = id;\n-\t\treturn __i2c_add_numbered_adapter(adapter);\n-\t}\n-\n-\tmutex_lock(&core_lock);\n-\tid = idr_alloc(&i2c_adapter_idr, NULL,\n-\t\t       __i2c_first_dynamic_bus_num, 0, GFP_KERNEL);\n-\tmutex_unlock(&core_lock);\n-\tif (WARN(id < 0, \"couldn't get idr\"))\n-\t\treturn id;\n+\tif (id < 0)\n+\t\tid = -1;\n \n \tadapter->nr = id;\n \n@@ -1708,10 +1709,7 @@ EXPORT_SYMBOL(i2c_add_adapter);\n  */\n int i2c_add_numbered_adapter(struct i2c_adapter *adap)\n {\n-\tif (adap->nr == -1) /* -1 means dynamically assign bus id */\n-\t\treturn i2c_add_adapter(adap);\n-\n-\treturn __i2c_add_numbered_adapter(adap);\n+\treturn i2c_register_adapter(adap);\n }\n EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter);\n \n",
    "prefixes": [
        "7/8"
    ]
}