{"id":2196255,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2196255/?format=json","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/1.0/projects/42/?format=json","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":"<20260213092958.864411-12-tzungbi@kernel.org>","date":"2026-02-13T09:29:58","name":"[v3,11/11] gpio: Remove unused `chip` and `srcu` in struct gpio_device","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"15eb6b4bb82affcd24b31a83b50c809845bf6d55","submitter":{"id":83557,"url":"http://patchwork.ozlabs.org/api/1.0/people/83557/?format=json","name":"Tzung-Bi Shih","email":"tzungbi@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20260213092958.864411-12-tzungbi@kernel.org/mbox/","series":[{"id":492068,"url":"http://patchwork.ozlabs.org/api/1.0/series/492068/?format=json","date":"2026-02-13T09:29:47","name":"gpio: Adopt revocable mechanism for UAF prevention","version":3,"mbox":"http://patchwork.ozlabs.org/series/492068/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2196255/checks/","tags":{},"headers":{"Return-Path":"\n <linux-gpio+bounces-31668-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=PTeHzrz7;\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-31668-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=\"PTeHzrz7\"","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 4fC6WL2n81z1xpl\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 20:36:46 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 1143C31B78D8\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 09:31:43 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 53DB134D917;\n\tFri, 13 Feb 2026 09:31:36 +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 1501834D4F1;\n\tFri, 13 Feb 2026 09:31:35 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 1832EC2BC86;\n\tFri, 13 Feb 2026 09:31:32 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1770975096; cv=none;\n b=eRK7bk6OFlyoPRCf9wQGMewX9dI+qmMZFIXwSEWhGE9iAxfEk5nbrRdDMinsAC2sA4jRMj4D/P+4KYVhYsjRpeVJmq4V/urlreLRJ4ykQhKa2FUpiVRQIMPwrEEwYT7Mh8A0LhKz2iHw1DLhmZOcPr7wHBJCkqIqrhhCIX9zF3s=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1770975096; c=relaxed/simple;\n\tbh=HELCfPtNvCvEoazpaboPAkrUFqcVe3WmgWs+WHvPHis=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=qoq4UdfYFZ0kNv55m4v2xNFwI8Y7rm4njQskaRZ7nrAXD/2NzxYf9wYdFaP7v0l41B4FgZ5j4XEUacOlssJ+gN+dU+VN/PNNTCuE4RCsbFQCbJpLDsj8iaQKdQ1BHAT1Gu2BJ78KjoHeMM9CWSVHScNX6E7yAhgjiA2AB91GdwU=","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=PTeHzrz7; 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=1770975095;\n\tbh=HELCfPtNvCvEoazpaboPAkrUFqcVe3WmgWs+WHvPHis=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=PTeHzrz7fBmNzxotEJYS7hqWo2i21aU5yS451f2gH4/xkQC65J7JEaSfuZGwdEp5h\n\t qaRw7SH2+YHJ0Rk5gqCgL3oitiq+K51odE8tuTAeeEgp0d17UyPa0HZ8ae5wphzFaW\n\t lK+sU9wfAR3J5aTT+riG+cP75ynvcG2RU1WDeSQv+exRBfecv1A3VBDzrnN4sUCPi3\n\t i2lmYTCSj3ZBMF7fDJ2EZplvqZIUTErpa9VUGxj7axVVGeDT/Iy8GNjWPN2wynTXag\n\t AO7PGO4RDDfwNAOWi7Els9HNOtwzbfDr2Fs2QrmZ8tCRzve1DKP3RX4ohb0iPkfpDr\n\t FoBArUrhNA9Rw==","From":"Tzung-Bi Shih <tzungbi@kernel.org>","To":"Bartosz Golaszewski <brgl@kernel.org>,\n\tLinus Walleij <linusw@kernel.org>","Cc":"Greg Kroah-Hartman <gregkh@linuxfoundation.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>,\n\tchrome-platform@lists.linux.dev,\n\ttzungbi@kernel.org,\n\tlinux-gpio@vger.kernel.org,\n\tlinux-kselftest@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org","Subject":"[PATCH v3 11/11] gpio: Remove unused `chip` and `srcu` in struct\n gpio_device","Date":"Fri, 13 Feb 2026 09:29:58 +0000","Message-ID":"<20260213092958.864411-12-tzungbi@kernel.org>","X-Mailer":"git-send-email 2.53.0.310.g728cabbaf7-goog","In-Reply-To":"<20260213092958.864411-1-tzungbi@kernel.org>","References":"<20260213092958.864411-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":"`chip` and `srcu` in struct gpio_device are unused as their usages are\nreplaced to use revocable.  Remove them.\n\nSigned-off-by: Tzung-Bi Shih <tzungbi@kernel.org>\n---\nv3:\n- No changes.\n\nv2: https://lore.kernel.org/all/20260203061059.975605-12-tzungbi@kernel.org\n- No changes.\n\nv1: https://lore.kernel.org/all/20260116081036.352286-24-tzungbi@kernel.org\n\n drivers/gpio/gpiolib.c | 26 +-------------------------\n drivers/gpio/gpiolib.h |  4 ----\n 2 files changed, 1 insertion(+), 29 deletions(-)","diff":"diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c\nindex 2ba78add3417..01be9f6978f2 100644\n--- a/drivers/gpio/gpiolib.c\n+++ b/drivers/gpio/gpiolib.c\n@@ -423,8 +423,6 @@ static int gpiochip_get_direction(struct gpio_chip *gc, unsigned int offset)\n {\n \tint ret;\n \n-\tlockdep_assert_held(&gc->gpiodev->srcu);\n-\n \tif (WARN_ON(!gc->get_direction))\n \t\treturn -EOPNOTSUPP;\n \n@@ -875,7 +873,6 @@ static void gpiodev_release(struct device *dev)\n \tida_free(&gpio_ida, gdev->id);\n \tkfree_const(gdev->label);\n \tkfree(gdev->descs);\n-\tcleanup_srcu_struct(&gdev->srcu);\n \tkfree(gdev);\n }\n \n@@ -1076,14 +1073,9 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,\n \t\tgoto err_free_gdev;\n \tgdev->id = ret;\n \n-\tret = init_srcu_struct(&gdev->srcu);\n-\tif (ret)\n-\t\tgoto err_free_ida;\n-\trcu_assign_pointer(gdev->chip, gc);\n-\n \tret = init_srcu_struct(&gdev->desc_srcu);\n \tif (ret)\n-\t\tgoto err_cleanup_gdev_srcu;\n+\t\tgoto err_free_ida;\n \n \tret = dev_set_name(&gdev->dev, GPIOCHIP_NAME \"%d\", gdev->id);\n \tif (ret)\n@@ -1276,8 +1268,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,\n \n err_cleanup_desc_srcu:\n \tcleanup_srcu_struct(&gdev->desc_srcu);\n-err_cleanup_gdev_srcu:\n-\tcleanup_srcu_struct(&gdev->srcu);\n err_free_ida:\n \tida_free(&gpio_ida, gdev->id);\n err_free_gdev:\n@@ -1314,8 +1304,6 @@ void gpiochip_remove(struct gpio_chip *gc)\n \tsynchronize_srcu(&gpio_devices_srcu);\n \n \t/* Numb the device, cancelling all outstanding operations */\n-\trcu_assign_pointer(gdev->chip, NULL);\n-\tsynchronize_srcu(&gdev->srcu);\n \trevocable_revoke(gdev->chip_rp);\n \tgpio_device_teardown_shared(gdev);\n \tgpiochip_irqchip_remove(gc);\n@@ -2815,8 +2803,6 @@ static int gpiochip_direction_input(struct gpio_chip *gc, unsigned int offset)\n {\n \tint ret;\n \n-\tlockdep_assert_held(&gc->gpiodev->srcu);\n-\n \tif (WARN_ON(!gc->direction_input))\n \t\treturn -EOPNOTSUPP;\n \n@@ -2832,8 +2818,6 @@ static int gpiochip_direction_output(struct gpio_chip *gc, unsigned int offset,\n {\n \tint ret;\n \n-\tlockdep_assert_held(&gc->gpiodev->srcu);\n-\n \tif (WARN_ON(!gc->direction_output))\n \t\treturn -EOPNOTSUPP;\n \n@@ -2921,8 +2905,6 @@ static int gpiochip_set(struct gpio_chip *gc, unsigned int offset, int value)\n {\n \tint ret;\n \n-\tlockdep_assert_held(&gc->gpiodev->srcu);\n-\n \tif (WARN_ON(unlikely(!gc->set)))\n \t\treturn -EOPNOTSUPP;\n \n@@ -3270,8 +3252,6 @@ static int gpiochip_get(struct gpio_chip *gc, unsigned int offset)\n {\n \tint ret;\n \n-\tlockdep_assert_held(&gc->gpiodev->srcu);\n-\n \t/* Make sure this is called after checking for gc->get(). */\n \tret = gc->get(gc, offset);\n \tif (ret > 1)\n@@ -3323,8 +3303,6 @@ static int gpiod_get_raw_value_commit(const struct gpio_desc *desc)\n static int gpio_chip_get_multiple(struct gpio_chip *gc,\n \t\t\t\t  unsigned long *mask, unsigned long *bits)\n {\n-\tlockdep_assert_held(&gc->gpiodev->srcu);\n-\n \tif (gc->get_multiple) {\n \t\tint ret;\n \n@@ -3668,8 +3646,6 @@ static int gpiochip_set_multiple(struct gpio_chip *gc,\n \tunsigned int i;\n \tint ret;\n \n-\tlockdep_assert_held(&gc->gpiodev->srcu);\n-\n \tif (gc->set_multiple) {\n \t\tret = gc->set_multiple(gc, mask, bits);\n \t\tif (ret > 0)\ndiff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h\nindex a254a57f37f5..6a97d9726c20 100644\n--- a/drivers/gpio/gpiolib.h\n+++ b/drivers/gpio/gpiolib.h\n@@ -28,7 +28,6 @@\n  * @chrdev: character device for the GPIO device\n  * @id: numerical ID number for the GPIO chip\n  * @owner: helps prevent removal of modules exporting active GPIOs\n- * @chip: pointer to the corresponding gpiochip, holding static\n  * data for this device\n  * @descs: array of ngpio descriptors.\n  * @valid_mask: If not %NULL, holds bitmask of GPIOs which are valid to be\n@@ -51,7 +50,6 @@\n  *                 process context\n  * @device_notifier: used to notify character device wait queues about the GPIO\n  *                   device being unregistered\n- * @srcu: protects the pointer to the underlying GPIO chip\n  * @chip_rp: revocable provider handle for the corresponding struct gpio_chip.\n  * @pin_ranges: range of pins served by the GPIO driver\n  *\n@@ -65,7 +63,6 @@ struct gpio_device {\n \tstruct cdev\t\tchrdev;\n \tint\t\t\tid;\n \tstruct module\t\t*owner;\n-\tstruct gpio_chip __rcu\t*chip;\n \tstruct gpio_desc\t*descs;\n \tunsigned long\t\t*valid_mask;\n \tstruct srcu_struct\tdesc_srcu;\n@@ -79,7 +76,6 @@ struct gpio_device {\n \trwlock_t\t\tline_state_lock;\n \tstruct workqueue_struct\t*line_state_wq;\n \tstruct blocking_notifier_head device_notifier;\n-\tstruct srcu_struct\tsrcu;\n \tstruct revocable\t*chip_rp;\n \n #ifdef CONFIG_PINCTRL\n","prefixes":["v3","11/11"]}