get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2228942,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2228942/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260427135841.96266-7-tzungbi@kernel.org/",
    "project": {
        "id": 42,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/42/?format=api",
        "name": "Linux GPIO development",
        "link_name": "linux-gpio",
        "list_id": "linux-gpio.vger.kernel.org",
        "list_email": "linux-gpio@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260427135841.96266-7-tzungbi@kernel.org>",
    "date": "2026-04-27T13:58:38",
    "name": "[v9,6/9] gpio: Leverage revocable for accessing struct gpio_chip",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "88c9fb4df85cad526cb0a58b093df87315c22a0a",
    "submitter": {
        "id": 83557,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/83557/?format=api",
        "name": "Tzung-Bi Shih",
        "email": "tzungbi@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260427135841.96266-7-tzungbi@kernel.org/mbox/",
    "series": [
        {
            "id": 501655,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/501655/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=501655",
            "date": "2026-04-27T13:58:32",
            "name": "drivers/base: Introduce revocable",
            "version": 9,
            "mbox": "http://patchwork.ozlabs.org/series/501655/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2228942/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2228942/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-gpio+bounces-35579-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-gpio@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=Oe0g0+R7;\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-gpio+bounces-35579-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=\"Oe0g0+R7\"",
            "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 4g453s6t7Tz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 00:07:21 +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 AD723310FB4A\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 13:59:59 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 612B63D333B;\n\tMon, 27 Apr 2026 13:59:53 +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 166E13D1718;\n\tMon, 27 Apr 2026 13:59:52 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 36F9DC2BCB9;\n\tMon, 27 Apr 2026 13:59:49 +0000 (UTC)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777298393; cv=none;\n b=ZZKOcQrhX4lainu27MN4mbhjlcprxU+5+ym70r09zEKOv+Kvvg8zKykjWSZPx3Kk25MT5jYE/sDlc9Tq3uac/FOSBTxAaWkjOvlZPKjjWKvkn/mQPTaagmspjUODho0itCQS+5iaMIaVzqWeK3V6bqameTfHyy+xm3OFo8chDn8=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777298393; c=relaxed/simple;\n\tbh=pi7ABDBl8gDgkbqRebEEglw8wiz3iI98IgsW5p9Mphk=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=G0eaxrJom4Kg4Ds+KYzVrBkSyBuQqOdMu4YWmPbzaPC1nBWiS33EMVf6oVhFPwVwGCNIU0GFAb43Q+PdiM6L3Z1ZMny8lXm7pDqZ1iFlrRyziLzzzRwOhMmkGCFRWfq9yFI1VQnOHiV+Hx1WB5qMbw9nQbLG8HvcWh9l/TmGtow=",
        "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=Oe0g0+R7; 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=1777298392;\n\tbh=pi7ABDBl8gDgkbqRebEEglw8wiz3iI98IgsW5p9Mphk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Oe0g0+R7UODZhbNROLkQUVhVbBAGr/0Uid3Wb0CS4kp2EzoOFqAEyR7Aq/c8E9whv\n\t U/8Ew7FoQBLW5MaK58EVwJ8FXyHm6BiDx8PZ5+RsYOFa2DWV7BEFupEAi7W5lScWLM\n\t Hn9EsorGlTEKRMGM8wuz7soA30Y5o0N+nAItPNggV/VPUbTHhKsNEffsQ7pYU+0Hh6\n\t tJ5PrC92MTdC4uyPgfeO36k5h8yI7xAikcQLXqDWmpEUTbVsbObAHW32J7QSj90qf2\n\t vLiG2h+tzyK/WGxQYuxqXSIK4MrB7dThJrJWJAV9MUnVol/M9gmFhvNRRCh6aSTMlk\n\t e9JLBd+kDgYSw==",
        "From": "Tzung-Bi Shih <tzungbi@kernel.org>",
        "To": "Arnd Bergmann <arnd@arndb.de>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\tBartosz Golaszewski <brgl@kernel.org>,\n\tLinus Walleij <linusw@kernel.org>",
        "Cc": "Benson Leung <bleung@chromium.org>,\n\ttzungbi@kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tchrome-platform@lists.linux.dev,\n\tdriver-core@lists.linux.dev,\n\tlinux-doc@vger.kernel.org,\n\tlinux-gpio@vger.kernel.org,\n\t\"Rafael J. Wysocki\" <rafael@kernel.org>,\n\tDanilo Krummrich <dakr@kernel.org>,\n\tJonathan Corbet <corbet@lwn.net>,\n\tShuah Khan <shuah@kernel.org>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tWolfram Sang <wsa+renesas@sang-engineering.com>,\n\tJason Gunthorpe <jgg@nvidia.com>,\n\tJohan Hovold <johan@kernel.org>,\n\t\"Paul E . McKenney\" <paulmck@kernel.org>,\n\tDan Williams <dan.j.williams@intel.com>",
        "Subject": "[PATCH v9 6/9] gpio: Leverage revocable for accessing struct\n gpio_chip",
        "Date": "Mon, 27 Apr 2026 21:58:38 +0800",
        "Message-ID": "<20260427135841.96266-7-tzungbi@kernel.org>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20260427135841.96266-1-tzungbi@kernel.org>",
        "References": "<20260427135841.96266-1-tzungbi@kernel.org>",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-gpio@vger.kernel.org",
        "List-Id": "<linux-gpio.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-gpio+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-gpio+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit"
    },
    "content": "Struct gpio_device now provides a revocable provider to the underlying\nstruct gpio_chip.  Leverage revocable for accessing the struct\ngpio_chip.\n\nSigned-off-by: Tzung-Bi Shih <tzungbi@kernel.org>\n---\nv9:\n- New to the series.\n- Rename \"chip_rp\" -> \"chip_rev\".\n\nv4 - v8:\n- Doesn't exist.\n\nv3: https://lore.kernel.org/all/20260213092958.864411-11-tzungbi@kernel.org\n- Change revocable API usages accordingly.\n\nv2: https://lore.kernel.org/all/20260203061059.975605-11-tzungbi@kernel.org\n- Separate from v1(a) for excluding gpio_chip_guard and combine v1(b).\n\nv1(a):\n- https://lore.kernel.org/all/20260116081036.352286-23-tzungbi@kernel.org\nv1(b):\n- https://lore.kernel.org/all/20260116081036.352286-19-tzungbi@kernel.org\n\n---\n drivers/gpio/gpiolib.c | 60 +++++++++++++-----------------------------\n 1 file changed, 18 insertions(+), 42 deletions(-)",
    "diff": "diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c\nindex 2cac1e15e1e5..798fd5f52745 100644\n--- a/drivers/gpio/gpiolib.c\n+++ b/drivers/gpio/gpiolib.c\n@@ -335,7 +335,10 @@ EXPORT_SYMBOL(gpio_device_get_label);\n  */\n struct gpio_chip *gpio_device_get_chip(struct gpio_device *gdev)\n {\n-\treturn rcu_dereference_check(gdev->chip, 1);\n+\tstruct gpio_chip *gc;\n+\n+\trevocable_try_access_with(&gdev->chip_rev, gc);\n+\treturn gc;\n }\n EXPORT_SYMBOL_GPL(gpio_device_get_chip);\n \n@@ -561,9 +564,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name)\n \n \tlist_for_each_entry_srcu(gdev, &gpio_devices, list,\n \t\t\t\t srcu_read_lock_held(&gpio_devices_srcu)) {\n-\t\tguard(srcu)(&gdev->srcu);\n-\n-\t\tgc = srcu_dereference(gdev->chip, &gdev->srcu);\n+\t\trevocable_try_access_with(&gdev->chip_rev, gc);\n \t\tif (!gc)\n \t\t\tcontinue;\n \n@@ -1050,9 +1051,7 @@ static void gpiochip_setup_devs(void)\n \n \tlist_for_each_entry_srcu(gdev, &gpio_devices, list,\n \t\t\t\t srcu_read_lock_held(&gpio_devices_srcu)) {\n-\t\tguard(srcu)(&gdev->srcu);\n-\n-\t\tgc = srcu_dereference(gdev->chip, &gdev->srcu);\n+\t\trevocable_try_access_with(&gdev->chip_rev, gc);\n \t\tif (!gc) {\n \t\t\tdev_err(&gdev->dev, \"Underlying GPIO chip is gone\\n\");\n \t\t\tcontinue;\n@@ -1455,11 +1454,11 @@ struct gpio_device *gpio_device_find(const void *data,\n \t\tif (!device_is_registered(&gdev->dev))\n \t\t\tcontinue;\n \n-\t\tguard(srcu)(&gdev->srcu);\n-\n-\t\tgc = srcu_dereference(gdev->chip, &gdev->srcu);\n+\t\trevocable_try_access_with(&gdev->chip_rev, gc);\n+\t\tif (!gc)\n+\t\t\tcontinue;\n \n-\t\tif (gc && match(gc, data))\n+\t\tif (match(gc, data))\n \t\t\treturn gpio_device_get(gdev);\n \t}\n \n@@ -3402,18 +3401,10 @@ static int gpio_chip_get_value(struct gpio_chip *gc, const struct gpio_desc *des\n \n static int gpiod_get_raw_value_commit(const struct gpio_desc *desc)\n {\n-\tstruct gpio_device *gdev;\n \tstruct gpio_chip *gc;\n \tint value;\n \n-\t/* FIXME Unable to use gpio_chip_guard due to const desc. */\n-\tgdev = desc->gdev;\n-\n-\tguard(srcu)(&gdev->srcu);\n-\n-\tgc = srcu_dereference(gdev->chip, &gdev->srcu);\n-\tif (!gc)\n-\t\treturn -ENODEV;\n+\trevocable_try_access_or_return(&desc->gdev->chip_rev, gc);\n \n \tvalue = gpio_chip_get_value(gc, desc);\n \tvalue = value < 0 ? value : !!value;\n@@ -3452,9 +3443,10 @@ static int gpio_chip_get_multiple(struct gpio_chip *gc,\n /* The 'other' chip must be protected with its GPIO device's SRCU. */\n static bool gpio_device_chip_cmp(struct gpio_device *gdev, struct gpio_chip *gc)\n {\n-\tguard(srcu)(&gdev->srcu);\n+\tstruct gpio_chip *chip;\n \n-\treturn gc == srcu_dereference(gdev->chip, &gdev->srcu);\n+\trevocable_try_access_with(&gdev->chip_rev, chip);\n+\treturn chip ? chip == gc : false;\n }\n \n int gpiod_get_array_value_complex(bool raw, bool can_sleep,\n@@ -3477,11 +3469,7 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep,\n \t\tif (!can_sleep)\n \t\t\tWARN_ON(array_info->gdev->can_sleep);\n \n-\t\tguard(srcu)(&array_info->gdev->srcu);\n-\t\tgc = srcu_dereference(array_info->gdev->chip,\n-\t\t\t\t      &array_info->gdev->srcu);\n-\t\tif (!gc)\n-\t\t\treturn -ENODEV;\n+\t\trevocable_try_access_or_return(&array_info->gdev->chip_rev, gc);\n \n \t\tret = gpio_chip_get_multiple(gc, array_info->get_mask,\n \t\t\t\t\t     value_bitmap);\n@@ -3818,11 +3806,7 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep,\n \t\t\t\treturn -EPERM;\n \t\t}\n \n-\t\tguard(srcu)(&array_info->gdev->srcu);\n-\t\tgc = srcu_dereference(array_info->gdev->chip,\n-\t\t\t\t      &array_info->gdev->srcu);\n-\t\tif (!gc)\n-\t\t\treturn -ENODEV;\n+\t\trevocable_try_access_or_return(&array_info->gdev->chip_rev, gc);\n \n \t\tif (!raw && !bitmap_empty(array_info->invert_mask, array_size))\n \t\t\tbitmap_xor(value_bitmap, value_bitmap,\n@@ -4117,7 +4101,6 @@ EXPORT_SYMBOL_GPL(gpiod_is_shared);\n  */\n int gpiod_to_irq(const struct gpio_desc *desc)\n {\n-\tstruct gpio_device *gdev;\n \tstruct gpio_chip *gc;\n \tint offset;\n \tint ret;\n@@ -4126,12 +4109,7 @@ int gpiod_to_irq(const struct gpio_desc *desc)\n \tif (ret <= 0)\n \t\treturn -EINVAL;\n \n-\tgdev = desc->gdev;\n-\t/* FIXME Cannot use gpio_chip_guard due to const desc. */\n-\tguard(srcu)(&gdev->srcu);\n-\tgc = srcu_dereference(gdev->chip, &gdev->srcu);\n-\tif (!gc)\n-\t\treturn -ENODEV;\n+\trevocable_try_access_or_return(&desc->gdev->chip_rev, gc);\n \n \toffset = gpiod_hwgpio(desc);\n \tif (gc->to_irq) {\n@@ -5470,9 +5448,7 @@ static int gpiolib_seq_show(struct seq_file *s, void *v)\n \tif (priv->newline)\n \t\tseq_putc(s, '\\n');\n \n-\tguard(srcu)(&gdev->srcu);\n-\n-\tgc = srcu_dereference(gdev->chip, &gdev->srcu);\n+\trevocable_try_access_with(&gdev->chip_rev, gc);\n \tif (!gc) {\n \t\tseq_printf(s, \"%s: (dangling chip)\\n\", dev_name(&gdev->dev));\n \t\treturn 0;\n",
    "prefixes": [
        "v9",
        "6/9"
    ]
}