From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
Kent Gibson <warthog618@gmail.com>
Cc: linux-gpio@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH libgpiod 2/7] tests: gpiosim: don't allow clearing hogs on active devices
Date: Mon, 06 Oct 2025 13:27:47 +0200 [thread overview]
Message-ID: <20251006-gpiosim-valid-lines-v1-2-b399373e90a9@linaro.org> (raw)
In-Reply-To: <20251006-gpiosim-valid-lines-v1-0-b399373e90a9@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Check if the GPIO device is pending in gpiosim_bank_clear_hog() before
actually trying to remove the hog directory.
Fixes: a2f6e8cd3540 ("libgpiosim: new library for controlling the gpio-sim module")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
tests/gpiosim/gpiosim.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/gpiosim/gpiosim.c b/tests/gpiosim/gpiosim.c
index 81bfd574817a1259f6b30dab52051a907414fd83..d48257534b887c8e9694afce80894a895379e1f1 100644
--- a/tests/gpiosim/gpiosim.c
+++ b/tests/gpiosim/gpiosim.c
@@ -1116,6 +1116,9 @@ GPIOSIM_API int gpiosim_bank_clear_hog(struct gpiosim_bank *bank,
unsigned int offset)
{
char buf[64];
+
+ if (!dev_check_pending(bank->dev))
+ return -1;
snprintf(buf, sizeof(buf), "line%u/hog", offset);
--
2.48.1
next prev parent reply other threads:[~2025-10-06 11:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 11:27 [PATCH libgpiod 0/7] tests: update libgpiosim tests and add a uAPI test case for valid lines Bartosz Golaszewski
2025-10-06 11:27 ` [PATCH libgpiod 1/7] tests: harness: use correct type to capture a boolean retval Bartosz Golaszewski
2025-10-06 11:27 ` Bartosz Golaszewski [this message]
2025-10-06 11:27 ` [PATCH libgpiod 3/7] tests: gpiosim: selftests: shrink the self-test code Bartosz Golaszewski
2025-10-06 11:27 ` [PATCH libgpiod 4/7] tests: gpiosim: selftests: add more test cases Bartosz Golaszewski
2025-10-06 11:27 ` [PATCH libgpiod 5/7] tests: gpiosim: provide gpiosim_bank_set_line_valid() Bartosz Golaszewski
2025-10-06 11:27 ` [PATCH libgpiod 6/7] tests: harness: support setting invalid lines Bartosz Golaszewski
2025-10-06 11:27 ` [PATCH libgpiod 7/7] tests: add a test case for checking " Bartosz Golaszewski
2025-10-09 8:16 ` [PATCH libgpiod 0/7] tests: update libgpiosim tests and add a uAPI test case for valid lines 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=20251006-gpiosim-valid-lines-v1-2-b399373e90a9@linaro.org \
--to=brgl@bgdev.pl \
--cc=bartosz.golaszewski@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.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).