From 6c176d69c19118ea3f5d2237e7225c4c4869895e Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Tue, 4 Feb 2025 09:47:42 +0100 Subject: python3-gpiod: fix ptest failure Linux kernel commit 8bd76b3d3f3a ("gpio: sim: lock up configfs that an instantiated device depends on") revealed an issue in libgpiod bindings tests where a GPIO simulator device is not disabled before removing its configfs entries. Add a patch (already submitted upstream) that fixes the observed ptest failures. Signed-off-by: Bartosz Golaszewski Signed-off-by: Khem Raj --- ...thon-tests-disable-device-before-releasin.patch | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-gpiod/0001-bindings-python-tests-disable-device-before-releasin.patch (limited to 'meta-python/recipes-devtools/python/python3-gpiod/0001-bindings-python-tests-disable-device-before-releasin.patch') diff --git a/meta-python/recipes-devtools/python/python3-gpiod/0001-bindings-python-tests-disable-device-before-releasin.patch b/meta-python/recipes-devtools/python/python3-gpiod/0001-bindings-python-tests-disable-device-before-releasin.patch new file mode 100644 index 0000000000..9025e0d72d --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-gpiod/0001-bindings-python-tests-disable-device-before-releasin.patch @@ -0,0 +1,49 @@ +From ad91b034e7575074998b3e480b592e3ae6d00def Mon Sep 17 00:00:00 2001 +From: Bartosz Golaszewski +Date: Tue, 4 Feb 2025 09:36:13 +0100 +Subject: [PATCH] bindings: python: tests: disable device before releasing the + bank + +Linux kernel commit 8bd76b3d3f3a ("gpio: sim: lock up configfs that an +instantiated device depends on") uncovered an issue in Python bindings +tests where the GPIO simulator device is not disabled before removing its +configfs entries. Reorder the operations in chip_finalize() in order to +disable the device first (if needed) before releasing any other +resources. + +Upstream-Status: Submitted [https://lore.kernel.org/all/20250203-fix-gpiosim-in-bindings-v1-2-d2c9e0f3a29d@linaro.org/] + +Signed-off-by: Bartosz Golaszewski +--- + tests/gpiosim/ext.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/tests/gpiosim/ext.c b/tests/gpiosim/ext.c +index 272e6f7..cb5611a 100644 +--- a/tests/gpiosim/ext.c ++++ b/tests/gpiosim/ext.c +@@ -96,15 +96,16 @@ static int chip_init(chip_object *self, + + static void chip_finalize(chip_object *self) + { +- if (self->bank) +- gpiosim_bank_unref(self->bank); +- + if (self->dev) { + if (gpiosim_dev_is_live(self->dev)) + gpiosim_dev_disable(self->dev); +- +- gpiosim_dev_unref(self->dev); + } ++ ++ if (self->bank) ++ gpiosim_bank_unref(self->bank); ++ ++ if (self->dev) ++ gpiosim_dev_unref(self->dev); + } + + static void chip_dealloc(PyObject *self) +-- +2.45.2 + -- cgit v1.2.3-54-g00ecf