git: 30d2f84ef2cb - main - LinuxKPI: firmware: change order filenames trying to load firmware
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 Dec 2024 19:45:15 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=30d2f84ef2cba12c67c62a9fe4e1d8e22cf27bf9 commit 30d2f84ef2cba12c67c62a9fe4e1d8e22cf27bf9 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2024-11-20 13:12:06 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2024-12-01 19:41:46 +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 MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D47682 --- 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 &&