On Wed, Jan 22, 2025 at 10:26:27AM GMT, Bartosz Golaszewski wrote:
On Wed, Jan 22, 2025 at 5:33 AM Koichiro Den koichiro.den@canonical.com wrote:
Since upstream commit 8bd76b3d3f3a ("gpio: sim: lock up configfs that an instantiated device depends on"), rmdir for an active virtual devices been prohibited.
Update gpio-sim selftest to align with the change.
Reported-by: kernel test robot oliver.sang@intel.com Closes: https://lore.kernel.org/oe-lkp/202501221006.a1ca5dfa-lkp@intel.com Signed-off-by: Koichiro Den koichiro.den@canonical.com
tools/testing/selftests/gpio/gpio-sim.sh | 31 +++++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/gpio/gpio-sim.sh b/tools/testing/selftests/gpio/gpio-sim.sh index 6fb66a687f17..bbc29ed9c60a 100755 --- a/tools/testing/selftests/gpio/gpio-sim.sh +++ b/tools/testing/selftests/gpio/gpio-sim.sh @@ -46,12 +46,6 @@ remove_chip() { rmdir $CONFIGFS_DIR/$CHIP || fail "Unable to remove the chip" }
-configfs_cleanup() {
for CHIP in `ls $CONFIGFS_DIR/`; do
remove_chip $CHIP
done
-}
create_chip() { local CHIP=$1
@@ -105,6 +99,13 @@ disable_chip() { echo 0 > $CONFIGFS_DIR/$CHIP/live || fail "Unable to disable the chip" }
+configfs_cleanup() {
for CHIP in `ls $CONFIGFS_DIR/`; do
disable_chip $CHIP
remove_chip $CHIP
done
+}
configfs_chip_name() { local CHIP=$1 local BANK=$2 @@ -181,6 +182,7 @@ create_chip chip create_bank chip bank enable_chip chip test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work" +disable_chip chip remove_chip chip
Hi! Thanks for addressing it.
Is there any place in this file where we'd call remove_chip() without calling disable_chip() first? Maybe we can fold disable_chip() into remove_chip() and make the patch much smaller?
My aplogies for being late.
Yes, there are five places where I intentionally omitted disable_chip() calls before remove_chip() because the chip wasn't enabled in thoses cases. I scattered disable_chip() calls only where truly necessary. I also think explicit enable_chip()/disable_chip() pairing look more clean and readable.
That being said, I'm fine with your suggestion.
-Koichiro Den
Bart