diff options
author | Hans de Goede <hdegoede@redhat.com> | 2020-04-17 19:15:27 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2020-04-22 19:43:58 +0200 |
commit | 0287c5d84f5c0cde6c39362d56c7002dc4acedb3 (patch) | |
tree | aa73d9ef6837614e6f889d6bab100a185db5dd7c /drivers/bluetooth/hci_bcm.c | |
parent | f8c51d28e9d13f20c33f4f2f46f8e7d0b8476b9c (diff) |
Bluetooth: btbcm: Fold Patch loading + applying into btbcm_initialize()
Instead of having btbcm_initialize() fill a passed in fw_name buffer
and then have its callers use that to request the firmware + load
it into the HCI, make btbcm_initialize() do this itself the first
time it is called (its get called a second time to reset the HCI
after the firmware has been loaded).
This removes some code duplication and makes it easier for further
patches in this series to try more then 1 firmware filename.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/hci_bcm.c')
-rw-r--r-- | drivers/bluetooth/hci_bcm.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index c42bf791a61b..61731cb451cb 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -553,8 +553,7 @@ static int bcm_flush(struct hci_uart *hu) static int bcm_setup(struct hci_uart *hu) { struct bcm_data *bcm = hu->priv; - char fw_name[64]; - const struct firmware *fw; + bool fw_load_done = false; unsigned int speed; int err; @@ -563,21 +562,12 @@ static int bcm_setup(struct hci_uart *hu) hu->hdev->set_diag = bcm_set_diag; hu->hdev->set_bdaddr = btbcm_set_bdaddr; - err = btbcm_initialize(hu->hdev, fw_name, sizeof(fw_name), false); + err = btbcm_initialize(hu->hdev, &fw_load_done); if (err) return err; - err = request_firmware(&fw, fw_name, &hu->hdev->dev); - if (err < 0) { - bt_dev_info(hu->hdev, "BCM: Patch %s not found", fw_name); + if (!fw_load_done) return 0; - } - - err = btbcm_patchram(hu->hdev, fw); - if (err) { - bt_dev_info(hu->hdev, "BCM: Patch failed (%d)", err); - goto finalize; - } /* Init speed if any */ if (hu->init_speed) @@ -616,9 +606,6 @@ static int bcm_setup(struct hci_uart *hu) btbcm_write_pcm_int_params(hu->hdev, ¶ms); } -finalize: - release_firmware(fw); - err = btbcm_finalize(hu->hdev); if (err) return err; |