Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2234950/?format=api
{ "id": 2234950, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2234950/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260508105448.31799-7-tzungbi@kernel.org/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/1.2/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": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260508105448.31799-7-tzungbi@kernel.org>", "list_archive_url": null, "date": "2026-05-08T10:54:45", "name": "[v10,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.2/people/83557/?format=api", "name": "Tzung-Bi Shih", "email": "tzungbi@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260508105448.31799-7-tzungbi@kernel.org/mbox/", "series": [ { "id": 503368, "url": "http://patchwork.ozlabs.org/api/1.2/series/503368/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=503368", "date": "2026-05-08T10:54:39", "name": "drivers/base: Introduce revocable", "version": 10, "mbox": "http://patchwork.ozlabs.org/series/503368/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2234950/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2234950/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-gpio+bounces-36450-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=jIv/ghbr;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-gpio+bounces-36450-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=\"jIv/ghbr\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\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 4gBmPh1sZNz1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 21:00:56 +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 53E2030A808A\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 8 May 2026 10:55:53 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 9D5253451AA;\n\tFri, 8 May 2026 10:55:44 +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 5BDE7337BB5;\n\tFri, 8 May 2026 10:55:44 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 7E227C2BCB0;\n\tFri, 8 May 2026 10:55:40 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778237744; cv=none;\n b=BPg8S7zUlL++wwla/arYLa9YhI7IcVktLh1DykOt+aAc535FqRXIwT3zC8i3MsD6dmPS/vo9OAMdpmtzI90hG6pRhoSO46fUfkJv+3xKajm8N2Vx3FVI4+9iRrTXxmKSPlLTWSvNhKgSL8OZEY5lUqxoA6QKh2oNQk80vcSGoZM=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778237744; c=relaxed/simple;\n\tbh=e7scW9mci2GzMCZUWCGmaXC5WgiFPb07UflccUab+fI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=o/8DBTMIuJ/cD9uOknNEgXr1z+9USXCy9cvxFAMwYUtGeKIraxrmzAI7ngVTZPbM950cNGh5UksX9G63gKKXULPWEczSO+5az0AaAY9Y+HbYtfPC+m4A+X+K8CA2tXjvNwEqWtR4WVCFutOq7HTQazj91OZmYPGCmJxe61E2YPE=", "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=jIv/ghbr; 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=1778237743;\n\tbh=e7scW9mci2GzMCZUWCGmaXC5WgiFPb07UflccUab+fI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=jIv/ghbr/fvXlD6p2N1u2jHqlygChItLff4aSG5FiezI6OmU533z73pUW+8jGqImy\n\t RTIFgbNeRpIvuwUvPfHDKdvlh2KiAVhHPFrH9kPp1wYWsgzE//++eH4/7PD7AdewmC\n\t XpwUoykO96VlaeYbYr6XeOgAEwcJm4c59M4Dl8Q5BgAnoTJ9HanEMtyrLhzf9x9x+i\n\t jhEJLtjrDfTQ7ajwMqBd/q7X+p/K6zHPZ5+KMl7pGKJkTUbS/jSa4PjZir7JdHFOn+\n\t +V+GDiNiYN+9NKzJtc1A+GyGJIR3Ow6EHkUVOu93jCFhmXdpAPL5IHgzo5wnsS++hd\n\t Wlf+ed9X27Fqw==", "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>", "Subject": "[PATCH v10 6/9] gpio: Leverage revocable for accessing struct\n gpio_chip", "Date": "Fri, 8 May 2026 18:54:45 +0800", "Message-ID": "<20260508105448.31799-7-tzungbi@kernel.org>", "X-Mailer": "git-send-email 2.51.0", "In-Reply-To": "<20260508105448.31799-1-tzungbi@kernel.org>", "References": "<20260508105448.31799-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---\nv10:\n- No changes.\n\nv9: https://lore.kernel.org/all/20260427135841.96266-7-tzungbi@kernel.org\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 0389d5f55282..d2d9807da98d 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@@ -1457,11 +1456,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@@ -3404,18 +3403,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@@ -3454,9 +3445,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@@ -3479,11 +3471,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@@ -3820,11 +3808,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@@ -4119,7 +4103,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@@ -4128,12 +4111,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@@ -5472,9 +5450,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": [ "v10", "6/9" ] }