From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Vincent Fazio <vfazio@xes-inc.com>,
Kent Gibson <warthog618@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Erik Schilling <erik.schilling@linaro.org>,
Phil Howard <phil@gadgetoid.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Koichiro Den <koichiro.den@canonical.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
linux-gpio@vger.kernel.org
Subject: [PATCH libgpiod 3/3] bindings: rust: tests: disable device before dropping the resources
Date: Mon, 03 Feb 2025 14:25:05 +0100 [thread overview]
Message-ID: <20250203-fix-gpiosim-in-bindings-v1-3-d2c9e0f3a29d@linaro.org> (raw)
In-Reply-To: <20250203-fix-gpiosim-in-bindings-v1-0-d2c9e0f3a29d@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Linux kernel commit 8bd76b3d3f3a ("gpio: sim: lock up configfs that an
instantiated device depends on") uncovered an issue in Rust bindings
tests where the GPIO simulator device is not disabled before removing its
configfs entries. Implenent Drop for the Sim struct in order to disable
the simulator first before dropping its bank and device objects.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/gpiosim-sys/src/sim.rs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/bindings/rust/gpiosim-sys/src/sim.rs b/bindings/rust/gpiosim-sys/src/sim.rs
index 71b9453..e3cc95c 100644
--- a/bindings/rust/gpiosim-sys/src/sim.rs
+++ b/bindings/rust/gpiosim-sys/src/sim.rs
@@ -328,3 +328,9 @@ impl Sim {
self.dev.disable()
}
}
+
+impl Drop for Sim {
+ fn drop(&mut self) {
+ self.dev.disable().unwrap()
+ }
+}
--
2.45.2
next prev parent reply other threads:[~2025-02-03 13:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 13:25 [PATCH libgpiod 0/3] bindings: fix ordering of releasing of gpiosim resources Bartosz Golaszewski
2025-02-03 13:25 ` [PATCH libgpiod 1/3] bindings: cxx: tests: disable GPIO simulator before releasing it Bartosz Golaszewski
2025-02-03 13:25 ` [PATCH libgpiod 2/3] bindings: python: tests: disable device before releasing the bank Bartosz Golaszewski
2025-02-03 13:25 ` Bartosz Golaszewski [this message]
2025-02-04 4:18 ` [PATCH libgpiod 3/3] bindings: rust: tests: disable device before dropping the resources Viresh Kumar
2025-02-04 8:29 ` Bartosz Golaszewski
2025-02-05 13:35 ` [PATCH libgpiod 0/3] bindings: fix ordering of releasing of gpiosim resources Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250203-fix-gpiosim-in-bindings-v1-3-d2c9e0f3a29d@linaro.org \
--to=brgl@bgdev.pl \
--cc=bartosz.golaszewski@linaro.org \
--cc=erik.schilling@linaro.org \
--cc=koichiro.den@canonical.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=phil@gadgetoid.com \
--cc=vfazio@xes-inc.com \
--cc=viresh.kumar@linaro.org \
--cc=warthog618@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).