Date: Sun, 18 Jul 2021 00:36:08 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: bdce1eea714c - stable/13 - LinuxKPI: treat firmware file names more lenient Message-ID: <202107180036.16I0a8Nd048730@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bdce1eea714cc6887206cff0fd02c06724390fe4 commit bdce1eea714cc6887206cff0fd02c06724390fe4 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2021-03-31 15:25:01 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2021-07-18 00:34:59 +0000 LinuxKPI: treat firmware file names more lenient A lot of firmware files have a "-" in the name. That "-" is a problem when dealing with shell variables or loader (e.g., auto-loading .ko). It may thus often be convenient to generate firmware kernel object files with s/-/_/g in the name. In order to automatically find them from drivers using LinuxKPI also substitue the '-' for a '_' like we do for '/' and '.' already. Reviewed by: hselasky, manu (ok) Differential Revision: https://reviews.freebsd.org/D29514 (cherry picked from commit 37c3241a43160dd236bd4767fce46e846cb17227) --- sys/compat/linuxkpi/common/src/linux_firmware.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c index 75147a311827..289779c5246c 100644 --- a/sys/compat/linuxkpi/common/src/linux_firmware.c +++ b/sys/compat/linuxkpi/common/src/linux_firmware.c @@ -85,9 +85,10 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * fwimg = fw_name; fbdfw = firmware_get_flags(fwimg, flags); } - /* (3) Flatten '/' and then '.' to '_' and try with adjusted name. */ + /* (3) Flatten '/', '.' and '-' to '_' and try with adjusted name. */ if (fbdfw == NULL && - (strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL)) { + (strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL || + strchr(fw_name, '-'))) { fwimg = strdup(fw_name, M_LKPI_FW); if (fwimg != NULL) { while ((p = strchr(fwimg, '/')) != NULL) @@ -98,6 +99,11 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware * *p = '_'; fbdfw = firmware_get_flags(fwimg, flags); } + if (fbdfw == NULL) { + while ((p = strchr(fwimg, '-')) != NULL) + *p = '_'; + fbdfw = firmware_get_flags(fwimg, flags); + } free(__DECONST(void *, fwimg), M_LKPI_FW); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107180036.16I0a8Nd048730>