diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2018-08-03 11:20:49 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2018-08-03 13:14:51 +0200 |
commit | 85418feff6faa96b6f3cee29235821d9afd8a592 (patch) | |
tree | df1848831dd6f8f290178f039868c125822dfeab /drivers/bluetooth/btusb.c | |
parent | Bluetooth: btusb: Release RF resource on BT shutdown (diff) | |
download | linux-85418feff6faa96b6f3cee29235821d9afd8a592.tar.xz linux-85418feff6faa96b6f3cee29235821d9afd8a592.zip |
Bluetooth: btusb: Use bt_dev_err for Intel firmware loading errors
Replace the BT_ERR functions with bt_dev_err to get a consistent error
printout that always prefixes the HCI device identifier.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth/btusb.c')
-rw-r--r-- | drivers/bluetooth/btusb.c | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index f99fc6bfd1da..cd2e5cf14ea5 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1598,13 +1598,13 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev, ret = request_firmware(&fw, fwname, &hdev->dev); if (ret < 0) { if (ret == -EINVAL) { - BT_ERR("%s Intel firmware file request failed (%d)", - hdev->name, ret); + bt_dev_err(hdev, "Intel firmware file request failed (%d)", + ret); return NULL; } - BT_ERR("%s failed to open Intel firmware file: %s(%d)", - hdev->name, fwname, ret); + bt_dev_err(hdev, "failed to open Intel firmware file: %s (%d)", + fwname, ret); /* If the correct firmware patch file is not found, use the * default firmware patch file instead @@ -1612,8 +1612,8 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev, snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bseq", ver->hw_platform, ver->hw_variant); if (request_firmware(&fw, fwname, &hdev->dev) < 0) { - BT_ERR("%s failed to open default Intel fw file: %s", - hdev->name, fwname); + bt_dev_err(hdev, "failed to open default fw file: %s", + fwname); return NULL; } } @@ -1642,7 +1642,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, * process. */ if (remain > HCI_COMMAND_HDR_SIZE && *fw_ptr[0] != 0x01) { - BT_ERR("%s Intel fw corrupted: invalid cmd read", hdev->name); + bt_dev_err(hdev, "Intel fw corrupted: invalid cmd read"); return -EINVAL; } (*fw_ptr)++; @@ -1656,7 +1656,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, * of command parameter. If not, the firmware file is corrupted. */ if (remain < cmd->plen) { - BT_ERR("%s Intel fw corrupted: invalid cmd len", hdev->name); + bt_dev_err(hdev, "Intel fw corrupted: invalid cmd len"); return -EFAULT; } @@ -1689,8 +1689,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, remain -= sizeof(*evt); if (remain < evt->plen) { - BT_ERR("%s Intel fw corrupted: invalid evt len", - hdev->name); + bt_dev_err(hdev, "Intel fw corrupted: invalid evt len"); return -EFAULT; } @@ -1704,15 +1703,15 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, * file is corrupted. */ if (!evt || !evt_param || remain < 0) { - BT_ERR("%s Intel fw corrupted: invalid evt read", hdev->name); + bt_dev_err(hdev, "Intel fw corrupted: invalid evt read"); return -EFAULT; } skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen, cmd_param, evt->evt, HCI_INIT_TIMEOUT); if (IS_ERR(skb)) { - BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", - hdev->name, cmd->opcode, PTR_ERR(skb)); + bt_dev_err(hdev, "sending Intel patch command (0x%4.4x) failed (%ld)", + cmd->opcode, PTR_ERR(skb)); return PTR_ERR(skb); } @@ -1721,15 +1720,15 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, * the contents of the event. */ if (skb->len != evt->plen) { - BT_ERR("%s mismatch event length (opcode 0x%4.4x)", hdev->name, - le16_to_cpu(cmd->opcode)); + bt_dev_err(hdev, "mismatch event length (opcode 0x%4.4x)", + le16_to_cpu(cmd->opcode)); kfree_skb(skb); return -EFAULT; } if (memcmp(skb->data, evt_param, evt->plen)) { - BT_ERR("%s mismatch event parameter (opcode 0x%4.4x)", - hdev->name, le16_to_cpu(cmd->opcode)); + bt_dev_err(hdev, "mismatch event parameter (opcode 0x%4.4x)", + le16_to_cpu(cmd->opcode)); kfree_skb(skb); return -EFAULT; } @@ -1758,8 +1757,8 @@ static int btusb_setup_intel(struct hci_dev *hdev) */ skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); if (IS_ERR(skb)) { - BT_ERR("%s sending initial HCI reset command failed (%ld)", - hdev->name, PTR_ERR(skb)); + bt_dev_err(hdev, "sending initial HCI reset command failed (%ld)", + PTR_ERR(skb)); return PTR_ERR(skb); } kfree_skb(skb); @@ -2089,8 +2088,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) * for now only accept this single value. */ if (ver.hw_platform != 0x37) { - BT_ERR("%s: Unsupported Intel hardware platform (%u)", - hdev->name, ver.hw_platform); + bt_dev_err(hdev, "Unsupported Intel hardware platform (%u)", + ver.hw_platform); return -EINVAL; } @@ -2109,8 +2108,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) case 0x14: /* QnJ, IcP */ break; default: - BT_ERR("%s: Unsupported Intel hardware variant (%u)", - hdev->name, ver.hw_variant); + bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)", + ver.hw_variant); return -EINVAL; } @@ -2139,8 +2138,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) * choice is to return an error and abort the device initialization. */ if (ver.fw_variant != 0x06) { - BT_ERR("%s: Unsupported Intel firmware variant (%u)", - hdev->name, ver.fw_variant); + bt_dev_err(hdev, "Unsupported Intel firmware variant (%u)", + ver.fw_variant); return -ENODEV; } @@ -2156,8 +2155,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) * that this bootloader does not send them, then abort the setup. */ if (params.limited_cce != 0x00) { - BT_ERR("%s: Unsupported Intel firmware loading method (%u)", - hdev->name, params.limited_cce); + bt_dev_err(hdev, "Unsupported Intel firmware loading method (%u)", + params.limited_cce); return -EINVAL; } @@ -2207,14 +2206,13 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) le16_to_cpu(ver.fw_revision)); break; default: - BT_ERR("%s: Unsupported Intel firmware naming", hdev->name); + bt_dev_err(hdev, "Unsupported Intel firmware naming"); return -EINVAL; } err = request_firmware(&fw, fwname, &hdev->dev); if (err < 0) { - BT_ERR("%s: Failed to load Intel firmware file (%d)", - hdev->name, err); + bt_dev_err(hdev, "Failed to load Intel firmware file (%d)", err); return err; } @@ -2240,13 +2238,13 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) le16_to_cpu(ver.fw_revision)); break; default: - BT_ERR("%s: Unsupported Intel firmware naming", hdev->name); + bt_dev_err(hdev, "Unsupported Intel firmware naming"); return -EINVAL; } if (fw->size < 644) { - BT_ERR("%s: Invalid size of firmware file (%zu)", - hdev->name, fw->size); + bt_dev_err(hdev, "Invalid size of firmware file (%zu)", + fw->size); err = -EBADF; goto done; } @@ -2277,18 +2275,18 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) TASK_INTERRUPTIBLE, msecs_to_jiffies(5000)); if (err == -EINTR) { - BT_ERR("%s: Firmware loading interrupted", hdev->name); + bt_dev_err(hdev, "Firmware loading interrupted"); goto done; } if (err) { - BT_ERR("%s: Firmware loading timeout", hdev->name); + bt_dev_err(hdev, "Firmware loading timeout"); err = -ETIMEDOUT; goto done; } if (test_bit(BTUSB_FIRMWARE_FAILED, &data->flags)) { - BT_ERR("%s: Firmware loading failed", hdev->name); + bt_dev_err(hdev, "Firmware loading failed"); err = -ENOEXEC; goto done; } @@ -2327,12 +2325,12 @@ done: msecs_to_jiffies(1000)); if (err == -EINTR) { - BT_ERR("%s: Device boot interrupted", hdev->name); + bt_dev_err(hdev, "Device boot interrupted"); return -EINTR; } if (err) { - BT_ERR("%s: Device boot timeout", hdev->name); + bt_dev_err(hdev, "Device boot timeout"); return -ETIMEDOUT; } @@ -2392,8 +2390,7 @@ static int btusb_shutdown_intel(struct hci_dev *hdev) skb = __hci_cmd_sync(hdev, 0xfc3f, 0, NULL, HCI_INIT_TIMEOUT); if (IS_ERR(skb)) { ret = PTR_ERR(skb); - BT_ERR("%s: turning off Intel device LED failed (%ld)", - hdev->name, ret); + bt_dev_err(hdev, "turning off Intel device LED failed"); return ret; } kfree_skb(skb); |