Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 2025 14:52:35 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 25017e9971d6 - stable/14 - LinuxKPI: firmware: change order filenames trying to load firmware
Message-ID:  <202502101452.51AEqZRP027693@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=25017e9971d6fe56618dcb5a5fb999f1c1d9e5fe

commit 25017e9971d6fe56618dcb5a5fb999f1c1d9e5fe
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-11-20 13:12:06 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-02-10 14:52:08 +0000

    LinuxKPI: firmware: change order filenames trying to load firmware
    
    Given we have the support in main and stable/14 to load plain firmware
    files from /boot/firmware/ make use of that.  Switch the order to
    try the original unmangled filename and path first before trying any
    replacements.
    This reduces time and console noise (especially under bootverbose).
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D47682
    
    (cherry picked from commit 30d2f84ef2cba12c67c62a9fe4e1d8e22cf27bf9)
---
 sys/compat/linuxkpi/common/src/linux_firmware.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c
index 17da91381280..12658df5ce83 100644
--- a/sys/compat/linuxkpi/common/src/linux_firmware.c
+++ b/sys/compat/linuxkpi/common/src/linux_firmware.c
@@ -88,17 +88,17 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware *
 	 * way rather than adding more name-mangling-hacks here in the future
 	 * (though we could if needed).
 	 */
-	/* (1) Try any name removed of path. */
-	fwimg = strrchr(fw_name, '/');
-	if (fwimg != NULL)
-		fwimg++;
-	if (fwimg == NULL || *fwimg == '\0')
-		fwimg = fw_name;
-	fbdfw = firmware_get_flags(fwimg, flags);
-	/* (2) Try the original name if we have not yet. */
-	if (fbdfw == NULL && fwimg != fw_name) {
-		fwimg = fw_name;
-		fbdfw = firmware_get_flags(fwimg, flags);
+	/* (1) Try the original name. */
+	fbdfw = firmware_get_flags(fw_name, flags);
+	/* (2) Try any name removed of path, if we have not yet. */
+	if (fbdfw == NULL) {
+		fwimg = strrchr(fw_name, '/');
+		if (fwimg != NULL)
+			fwimg++;
+		if (fwimg == NULL || *fwimg == '\0')
+			fwimg = fw_name;
+		if (fwimg != fw_name)
+			fbdfw = firmware_get_flags(fwimg, flags);
 	}
 	/* (3) Flatten '/', '.' and '-' to '_' and try with adjusted name. */
 	if (fbdfw == NULL &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502101452.51AEqZRP027693>