* [PATCH] selftests: gpio: correctly check the type of /dev/gpiochipX
@ 2025-11-27 8:55 Guixin Liu
2025-12-04 1:45 ` Guixin Liu
0 siblings, 1 reply; 2+ messages in thread
From: Guixin Liu @ 2025-11-27 8:55 UTC (permalink / raw)
To: Bamvor Jian Zhang, Shuah Khan; +Cc: linux-gpio, linux-kselftest
/dev/gpiochipX is a character device, not a directory, so we should
use "test -c" instead of "test -d" to check for its existence;
otherwise, the current check will not work correctly when
/dev/gpiochipX is left over (e.g., as a stale device node).
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
tools/testing/selftests/gpio/gpio-aggregator.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/gpio/gpio-aggregator.sh b/tools/testing/selftests/gpio/gpio-aggregator.sh
index 9b6f80ad9f8a..13d8e1607571 100755
--- a/tools/testing/selftests/gpio/gpio-aggregator.sh
+++ b/tools/testing/selftests/gpio/gpio-aggregator.sh
@@ -351,7 +351,7 @@ test "$(agg_get_chip_num_lines _sysfs.0)" = "1" || fail "number of lines is not
test "$(agg_get_line_name _sysfs.0 0)" = "" || fail "line name is unset"
echo "$(agg_configfs_dev_name _sysfs.0)" > "$SYSFS_AGG_DIR/delete_device"
test -d $CONFIGFS_AGG_DIR/_sysfs.0 && fail "_sysfs.0 unexpectedly remains"
-test -d /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
+test -c /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
echo "1.2.2. Complex creation/deletion"
echo "chip0bank0_0 chip1_bank1 10-11" > "$SYSFS_AGG_DIR/new_device"
@@ -365,7 +365,7 @@ test "$(agg_get_line_name _sysfs.0 1)" = "" || fail "line name is unset"
test "$(agg_get_line_name _sysfs.0 2)" = "" || fail "line name is unset"
echo "$(agg_configfs_dev_name _sysfs.0)" > "$SYSFS_AGG_DIR/delete_device"
test -d $CONFIGFS_AGG_DIR/_sysfs.0 && fail "_sysfs.0 unexpectedly remains"
-test -d /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
+test -c /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
echo "1.2.3. Asynchronous creation with deferred probe"
sim_disable_chip chip0
@@ -382,7 +382,7 @@ test "$(agg_get_chip_num_lines _sysfs.0)" = "1" || fail "number of lines is not
test "$(agg_get_line_name _sysfs.0 0)" = "" || fail "line name unexpectedly set"
echo "$(agg_configfs_dev_name _sysfs.0)" > "$SYSFS_AGG_DIR/delete_device"
test -d $CONFIGFS_AGG_DIR/_sysfs.0 && fail "_sysfs.0 unexpectedly remains"
-test -d /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
+test -c /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
echo "1.2.4. Can't instantiate a chip with invalid configuration"
echo "xyz 0" > "$SYSFS_AGG_DIR/new_device"
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests: gpio: correctly check the type of /dev/gpiochipX
2025-11-27 8:55 [PATCH] selftests: gpio: correctly check the type of /dev/gpiochipX Guixin Liu
@ 2025-12-04 1:45 ` Guixin Liu
0 siblings, 0 replies; 2+ messages in thread
From: Guixin Liu @ 2025-12-04 1:45 UTC (permalink / raw)
To: Bamvor Jian Zhang, Shuah Khan; +Cc: linux-gpio, linux-kselftest
Friendly ping...
Best Regards,
Guixin Liu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-04 1:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-27 8:55 [PATCH] selftests: gpio: correctly check the type of /dev/gpiochipX Guixin Liu
2025-12-04 1:45 ` Guixin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox