From fbe6481cd34eb6bac9535dcb52e892ae8151bb6b Mon Sep 17 00:00:00 2001 From: Isaac Hermida Date: Tue, 25 Jun 2024 19:52:39 +0200 Subject: [PATCH] kernel-module-qualcomm: add lock file to avoid endless call to script in failure Add a lock file to avoid to call the file continuously if the initial probe failed. Signed-off-by: Isaac Hermida --- .../kernel-module-qualcomm/qualcomm.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh index e53c799fb..f6a46d1b1 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2023 Digi International Inc. +# Copyright (c) 2023,2024 Digi International Inc. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this @@ -16,6 +16,8 @@ # MMC_NODE="##NODE##" +# Lock file to track and prevent to re-run the script when rebinding the MMC node. +LOCKFILE="/tmp/qca65x4.lock" # At this point of the boot (udev script), the system log (syslog) is not # available yet, so use the kernel log buffer from userspace. @@ -23,6 +25,12 @@ log() { printf "<$1>qca65x4: $2\n" >/dev/kmsg } +if test -f "$LOCKFILE"; then + # Script called due to rebinding of mmc. Ignore it and remove the lock file. + rm $LOCKFILE + exit 1 +fi + # Force re-detection of the mmc node rebind_mmc_node() { DRIVER_NODE=$(find /sys/bus/platform/drivers -name ${MMC_NODE} | xargs dirname 2> /dev/null) || return 1 @@ -48,6 +56,10 @@ load_and_check && log "3" "[INFO] wlan module loaded" && exit 0 # If we are here, the load has failed. Retry. log "3" "[WARN] Loading wlan module failed, retrying..." +# Create a lock file, as rebinding the mmc node will trigger the udev rules +# Do not remove the file at the end, it will be called by the script in the rebind call +touch $LOCKFILE + # Try by re-binding the mmc node. rebind_mmc_node && load_and_check && log "3" "[INFO] wlan module loaded" && exit 0