diff mbox series

[1/3] Bluetooth: btrtl: try config w/o postfix if postfixed one failed to load

Message ID BYAPR20MB24723A54E913F0218DF87F83BCF79@BYAPR20MB2472.namprd20.prod.outlook.com
State New
Headers show
Series [1/3] Bluetooth: btrtl: try config w/o postfix if postfixed one failed to load | expand

Commit Message

icenowy@outlook.com April 22, 2022, 4:02 p.m. UTC
From: Icenowy Zheng <icenowy@sipeed.com>

We should try the non-prefixed config file name if the prefixed one
failed to load (possibly because of it does not exist).

Add this behavior to firmware-loading routine.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
---
 drivers/bluetooth/btrtl.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 481d488bca0f..1f834513762b 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -699,6 +699,12 @@  struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
 		}
 		btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name,
 						   &btrtl_dev->cfg_data);
+		if (postfix && btrtl_dev->cfg_len <= 0) {
+			snprintf(cfg_name, sizeof(cfg_name), "%s.bin",
+				 btrtl_dev->ic_info->cfg_name);
+			btrtl_dev->cfg_len = rtl_load_file(hdev, cfg_name,
+							&btrtl_dev->cfg_data);
+		}
 		if (btrtl_dev->ic_info->config_needed &&
 		    btrtl_dev->cfg_len <= 0) {
 			rtl_dev_err(hdev, "mandatory config file %s not found",