aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2024-11-20 13:12:06 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2024-12-01 19:41:46 +0000
commit30d2f84ef2cba12c67c62a9fe4e1d8e22cf27bf9 (patch)
treec10d8992ddbb9b8d007e74b725411c259d38df2a
parentf7cf62cf728a942e494a5b58438600998606617a (diff)
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
-rw-r--r--sys/compat/linuxkpi/common/src/linux_firmware.c22
1 files 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 &&