gpio: Leverage revocable for accessing struct gpio_chip The underlying chip can be removed asynchronously. `gdev->srcu` is used to ensure the synchronization before accessing `gdev->chip`. Revocable encapsulates the details. Leverage revocable for accessing the struct gpio_chip and remove the `gdev->srcu`. Tested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> --- Test: Prepare gpiod-test. (https://libgpiod.readthedocs.io/en/master/building.html#building) $ cd libgpiod-2.3.1 $ mkdir build && cd build $ meson setup .. -Dtools=enabled $ ninja Prepare kernel. $ cat >test_config <<EOF CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_KASAN=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_SIM=y CONFIG_EXPERT=y CONFIG_PROVE_LOCKING=y CONFIG_PANIC_ON_OOPS=y CONFIG_DEBUG_KERNEL=y CONFIG_LOCKDEP=y EOF $ export KBUILD_OUTPUT=build $ vng -k -f test_config && vng -b Run gpiod-test. $ vng $ ./libgpiod-2.3.1/build/tests/gpiod-test $ time ./libgpiod-2.3.1/build/tests/gpiod-test >/dev/null 2>&1 --- v14: - Rebase onto next-20261007. - Fix conflicts with 1feb5d39b05a ("gpio: cdev: fix kernel stack leak to user-space in error path") v13: https://lore.kernel.org/all/20260912123529.7951-4-tzungbi@kernel.org - Call revocable_deinit() instead of revocable_put() as it uses embedded allocation. v12: https://lore.kernel.org/all/20260908134223.13638-4-tzungbi@kernel.org - Rebase onto next-20260907. - Fix conflicts mainly with aa7e8b7ef031 ("gpio: core: fix const-correctness of gpio_chip_guard"). - Fix error unwinding in gpiochip_add_data_with_key() by initializing chip_rev before device_initialize() and ensuring both references are dropped on error. v11: https://lore.kernel.org/all/20260513091043.6766-4-tzungbi@kernel.org - Add Tested-by tag. - Squash - https://lore.kernel.org/all/20260508105448.31799-5-tzungbi@kernel.org - https://lore.kernel.org/all/20260508105448.31799-6-tzungbi@kernel.org - https://lore.kernel.org/all/20260508105448.31799-7-tzungbi@kernel.org - https://lore.kernel.org/all/20260508105448.31799-8-tzungbi@kernel.org v10: https://lore.kernel.org/all/20260508105448.31799-4-tzungbi@kernel.org - Change revocable API usages accordingly. v9: https://lore.kernel.org/all/20260427135841.96266-4-tzungbi@kernel.org - New to the series. - Use static allocated resource provider. - Rename "chip_rp" -> "chip_rev". v4 - v8: - Doesn't exist. v3: https://lore.kernel.org/all/20260213092958.864411-8-tzungbi@kernel.org - Change revocable API usages accordingly. v2: https://lore.kernel.org/all/20260203061059.975605-8-tzungbi@kernel.org - Change usages accordingly after applying https://lore.kernel.org/all/20260129143733.45618-2-tzungbi@kernel.org. - Add __rcu for `chip_rp`. - Pass pointer of pointer to revocable_provider_revoke(). - Rebase accordingly after applying https://lore.kernel.org/all/20260203060210.972243-1-tzungbi@kernel.org. v1: https://lore.kernel.org/all/20260116081036.352286-13-tzungbi@kernel.org