[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9c22c80334d5a895e9d47681d57d6c7965f3c086.1714082459.git.sean.wang@kernel.org>
Date: Thu, 25 Apr 2024 15:06:28 -0700
From: sean.wang@...nel.org
To: marcel@...tmann.org,
johan.hedberg@...il.com,
luiz.dentz@...il.com
Cc: linux-bluetooth@...r.kernel.org,
linux-mediatek@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Sean Wang <sean.wang@...iatek.com>
Subject: [PATCH v3 2/5] Bluetooth: btmtk: apply the common btmtk_fw_get_filename
From: Sean Wang <sean.wang@...iatek.com>
Apply the common btmtk_fw_get_filename to avoid the similar coding in each
driver.
Signed-off-by: Sean Wang <sean.wang@...iatek.com>
---
v3: first added to the series
---
drivers/bluetooth/btmtksdio.c | 6 +++---
drivers/bluetooth/btusb.c | 10 ++--------
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index ff4868c83cd8..10bf273120d6 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -1117,9 +1117,9 @@ static int btmtksdio_setup(struct hci_dev *hdev)
return err;
}
- snprintf(fwname, sizeof(fwname),
- "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
- dev_id & 0xffff, (fw_version & 0xff) + 1);
+ btmtk_fw_get_filename(fwname, sizeof(fwname), dev_id,
+ fw_version);
+
err = mt79xx_setup(hdev, fwname);
if (err < 0)
return err;
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 7835170b1d66..bad6a9888dca 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3123,14 +3123,8 @@ static int btusb_mtk_setup(struct hci_dev *hdev)
case 0x7922:
case 0x7961:
case 0x7925:
- if (dev_id == 0x7925)
- snprintf(fw_bin_name, sizeof(fw_bin_name),
- "mediatek/mt%04x/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
- dev_id & 0xffff, dev_id & 0xffff, (fw_version & 0xff) + 1);
- else
- snprintf(fw_bin_name, sizeof(fw_bin_name),
- "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
- dev_id & 0xffff, (fw_version & 0xff) + 1);
+ btmtk_fw_get_filename(fw_bin_name, sizeof(fw_bin_name), dev_id,
+ fw_version);
err = btmtk_setup_firmware_79xx(hdev, fw_bin_name,
btusb_mtk_hci_wmt_sync);
--
2.25.1
Powered by blists - more mailing lists