aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2018-08-03 05:20:49 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2018-08-03 07:14:51 -0400
commit85418feff6faa96b6f3cee29235821d9afd8a592 (patch)
treedf1848831dd6f8f290178f039868c125822dfeab
parent1313bccf00f6dfef99724d58e4416281b71e7189 (diff)
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>
-rw-r--r--drivers/bluetooth/btusb.c77
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,
1598 ret = request_firmware(&fw, fwname, &hdev->dev); 1598 ret = request_firmware(&fw, fwname, &hdev->dev);
1599 if (ret < 0) { 1599 if (ret < 0) {
1600 if (ret == -EINVAL) { 1600 if (ret == -EINVAL) {
1601 BT_ERR("%s Intel firmware file request failed (%d)", 1601 bt_dev_err(hdev, "Intel firmware file request failed (%d)",
1602 hdev->name, ret); 1602 ret);
1603 return NULL; 1603 return NULL;
1604 } 1604 }
1605 1605
1606 BT_ERR("%s failed to open Intel firmware file: %s(%d)", 1606 bt_dev_err(hdev, "failed to open Intel firmware file: %s (%d)",
1607 hdev->name, fwname, ret); 1607 fwname, ret);
1608 1608
1609 /* If the correct firmware patch file is not found, use the 1609 /* If the correct firmware patch file is not found, use the
1610 * default firmware patch file instead 1610 * default firmware patch file instead
@@ -1612,8 +1612,8 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev,
1612 snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bseq", 1612 snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bseq",
1613 ver->hw_platform, ver->hw_variant); 1613 ver->hw_platform, ver->hw_variant);
1614 if (request_firmware(&fw, fwname, &hdev->dev) < 0) { 1614 if (request_firmware(&fw, fwname, &hdev->dev) < 0) {
1615 BT_ERR("%s failed to open default Intel fw file: %s", 1615 bt_dev_err(hdev, "failed to open default fw file: %s",
1616 hdev->name, fwname); 1616 fwname);
1617 return NULL; 1617 return NULL;
1618 } 1618 }
1619 } 1619 }
@@ -1642,7 +1642,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
1642 * process. 1642 * process.
1643 */ 1643 */
1644 if (remain > HCI_COMMAND_HDR_SIZE && *fw_ptr[0] != 0x01) { 1644 if (remain > HCI_COMMAND_HDR_SIZE && *fw_ptr[0] != 0x01) {
1645 BT_ERR("%s Intel fw corrupted: invalid cmd read", hdev->name); 1645 bt_dev_err(hdev, "Intel fw corrupted: invalid cmd read");
1646 return -EINVAL; 1646 return -EINVAL;
1647 } 1647 }
1648 (*fw_ptr)++; 1648 (*fw_ptr)++;
@@ -1656,7 +1656,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
1656 * of command parameter. If not, the firmware file is corrupted. 1656 * of command parameter. If not, the firmware file is corrupted.
1657 */ 1657 */
1658 if (remain < cmd->plen) { 1658 if (remain < cmd->plen) {
1659 BT_ERR("%s Intel fw corrupted: invalid cmd len", hdev->name); 1659 bt_dev_err(hdev, "Intel fw corrupted: invalid cmd len");
1660 return -EFAULT; 1660 return -EFAULT;
1661 } 1661 }
1662 1662
@@ -1689,8 +1689,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
1689 remain -= sizeof(*evt); 1689 remain -= sizeof(*evt);
1690 1690
1691 if (remain < evt->plen) { 1691 if (remain < evt->plen) {
1692 BT_ERR("%s Intel fw corrupted: invalid evt len", 1692 bt_dev_err(hdev, "Intel fw corrupted: invalid evt len");
1693 hdev->name);
1694 return -EFAULT; 1693 return -EFAULT;
1695 } 1694 }
1696 1695
@@ -1704,15 +1703,15 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
1704 * file is corrupted. 1703 * file is corrupted.
1705 */ 1704 */
1706 if (!evt || !evt_param || remain < 0) { 1705 if (!evt || !evt_param || remain < 0) {
1707 BT_ERR("%s Intel fw corrupted: invalid evt read", hdev->name); 1706 bt_dev_err(hdev, "Intel fw corrupted: invalid evt read");
1708 return -EFAULT; 1707 return -EFAULT;
1709 } 1708 }
1710 1709
1711 skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen, 1710 skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen,
1712 cmd_param, evt->evt, HCI_INIT_TIMEOUT); 1711 cmd_param, evt->evt, HCI_INIT_TIMEOUT);
1713 if (IS_ERR(skb)) { 1712 if (IS_ERR(skb)) {
1714 BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", 1713 bt_dev_err(hdev, "sending Intel patch command (0x%4.4x) failed (%ld)",
1715 hdev->name, cmd->opcode, PTR_ERR(skb)); 1714 cmd->opcode, PTR_ERR(skb));
1716 return PTR_ERR(skb); 1715 return PTR_ERR(skb);
1717 } 1716 }
1718 1717
@@ -1721,15 +1720,15 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
1721 * the contents of the event. 1720 * the contents of the event.
1722 */ 1721 */
1723 if (skb->len != evt->plen) { 1722 if (skb->len != evt->plen) {
1724 BT_ERR("%s mismatch event length (opcode 0x%4.4x)", hdev->name, 1723 bt_dev_err(hdev, "mismatch event length (opcode 0x%4.4x)",
1725 le16_to_cpu(cmd->opcode)); 1724 le16_to_cpu(cmd->opcode));
1726 kfree_skb(skb); 1725 kfree_skb(skb);
1727 return -EFAULT; 1726 return -EFAULT;
1728 } 1727 }
1729 1728
1730 if (memcmp(skb->data, evt_param, evt->plen)) { 1729 if (memcmp(skb->data, evt_param, evt->plen)) {
1731 BT_ERR("%s mismatch event parameter (opcode 0x%4.4x)", 1730 bt_dev_err(hdev, "mismatch event parameter (opcode 0x%4.4x)",
1732 hdev->name, le16_to_cpu(cmd->opcode)); 1731 le16_to_cpu(cmd->opcode));
1733 kfree_skb(skb); 1732 kfree_skb(skb);
1734 return -EFAULT; 1733 return -EFAULT;
1735 } 1734 }
@@ -1758,8 +1757,8 @@ static int btusb_setup_intel(struct hci_dev *hdev)
1758 */ 1757 */
1759 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); 1758 skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
1760 if (IS_ERR(skb)) { 1759 if (IS_ERR(skb)) {
1761 BT_ERR("%s sending initial HCI reset command failed (%ld)", 1760 bt_dev_err(hdev, "sending initial HCI reset command failed (%ld)",
1762 hdev->name, PTR_ERR(skb)); 1761 PTR_ERR(skb));
1763 return PTR_ERR(skb); 1762 return PTR_ERR(skb);
1764 } 1763 }
1765 kfree_skb(skb); 1764 kfree_skb(skb);
@@ -2089,8 +2088,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2089 * for now only accept this single value. 2088 * for now only accept this single value.
2090 */ 2089 */
2091 if (ver.hw_platform != 0x37) { 2090 if (ver.hw_platform != 0x37) {
2092 BT_ERR("%s: Unsupported Intel hardware platform (%u)", 2091 bt_dev_err(hdev, "Unsupported Intel hardware platform (%u)",
2093 hdev->name, ver.hw_platform); 2092 ver.hw_platform);
2094 return -EINVAL; 2093 return -EINVAL;
2095 } 2094 }
2096 2095
@@ -2109,8 +2108,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2109 case 0x14: /* QnJ, IcP */ 2108 case 0x14: /* QnJ, IcP */
2110 break; 2109 break;
2111 default: 2110 default:
2112 BT_ERR("%s: Unsupported Intel hardware variant (%u)", 2111 bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
2113 hdev->name, ver.hw_variant); 2112 ver.hw_variant);
2114 return -EINVAL; 2113 return -EINVAL;
2115 } 2114 }
2116 2115
@@ -2139,8 +2138,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2139 * choice is to return an error and abort the device initialization. 2138 * choice is to return an error and abort the device initialization.
2140 */ 2139 */
2141 if (ver.fw_variant != 0x06) { 2140 if (ver.fw_variant != 0x06) {
2142 BT_ERR("%s: Unsupported Intel firmware variant (%u)", 2141 bt_dev_err(hdev, "Unsupported Intel firmware variant (%u)",
2143 hdev->name, ver.fw_variant); 2142 ver.fw_variant);
2144 return -ENODEV; 2143 return -ENODEV;
2145 } 2144 }
2146 2145
@@ -2156,8 +2155,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2156 * that this bootloader does not send them, then abort the setup. 2155 * that this bootloader does not send them, then abort the setup.
2157 */ 2156 */
2158 if (params.limited_cce != 0x00) { 2157 if (params.limited_cce != 0x00) {
2159 BT_ERR("%s: Unsupported Intel firmware loading method (%u)", 2158 bt_dev_err(hdev, "Unsupported Intel firmware loading method (%u)",
2160 hdev->name, params.limited_cce); 2159 params.limited_cce);
2161 return -EINVAL; 2160 return -EINVAL;
2162 } 2161 }
2163 2162
@@ -2207,14 +2206,13 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2207 le16_to_cpu(ver.fw_revision)); 2206 le16_to_cpu(ver.fw_revision));
2208 break; 2207 break;
2209 default: 2208 default:
2210 BT_ERR("%s: Unsupported Intel firmware naming", hdev->name); 2209 bt_dev_err(hdev, "Unsupported Intel firmware naming");
2211 return -EINVAL; 2210 return -EINVAL;
2212 } 2211 }
2213 2212
2214 err = request_firmware(&fw, fwname, &hdev->dev); 2213 err = request_firmware(&fw, fwname, &hdev->dev);
2215 if (err < 0) { 2214 if (err < 0) {
2216 BT_ERR("%s: Failed to load Intel firmware file (%d)", 2215 bt_dev_err(hdev, "Failed to load Intel firmware file (%d)", err);
2217 hdev->name, err);
2218 return err; 2216 return err;
2219 } 2217 }
2220 2218
@@ -2240,13 +2238,13 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2240 le16_to_cpu(ver.fw_revision)); 2238 le16_to_cpu(ver.fw_revision));
2241 break; 2239 break;
2242 default: 2240 default:
2243 BT_ERR("%s: Unsupported Intel firmware naming", hdev->name); 2241 bt_dev_err(hdev, "Unsupported Intel firmware naming");
2244 return -EINVAL; 2242 return -EINVAL;
2245 } 2243 }
2246 2244
2247 if (fw->size < 644) { 2245 if (fw->size < 644) {
2248 BT_ERR("%s: Invalid size of firmware file (%zu)", 2246 bt_dev_err(hdev, "Invalid size of firmware file (%zu)",
2249 hdev->name, fw->size); 2247 fw->size);
2250 err = -EBADF; 2248 err = -EBADF;
2251 goto done; 2249 goto done;
2252 } 2250 }
@@ -2277,18 +2275,18 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2277 TASK_INTERRUPTIBLE, 2275 TASK_INTERRUPTIBLE,
2278 msecs_to_jiffies(5000)); 2276 msecs_to_jiffies(5000));
2279 if (err == -EINTR) { 2277 if (err == -EINTR) {
2280 BT_ERR("%s: Firmware loading interrupted", hdev->name); 2278 bt_dev_err(hdev, "Firmware loading interrupted");
2281 goto done; 2279 goto done;
2282 } 2280 }
2283 2281
2284 if (err) { 2282 if (err) {
2285 BT_ERR("%s: Firmware loading timeout", hdev->name); 2283 bt_dev_err(hdev, "Firmware loading timeout");
2286 err = -ETIMEDOUT; 2284 err = -ETIMEDOUT;
2287 goto done; 2285 goto done;
2288 } 2286 }
2289 2287
2290 if (test_bit(BTUSB_FIRMWARE_FAILED, &data->flags)) { 2288 if (test_bit(BTUSB_FIRMWARE_FAILED, &data->flags)) {
2291 BT_ERR("%s: Firmware loading failed", hdev->name); 2289 bt_dev_err(hdev, "Firmware loading failed");
2292 err = -ENOEXEC; 2290 err = -ENOEXEC;
2293 goto done; 2291 goto done;
2294 } 2292 }
@@ -2327,12 +2325,12 @@ done:
2327 msecs_to_jiffies(1000)); 2325 msecs_to_jiffies(1000));
2328 2326
2329 if (err == -EINTR) { 2327 if (err == -EINTR) {
2330 BT_ERR("%s: Device boot interrupted", hdev->name); 2328 bt_dev_err(hdev, "Device boot interrupted");
2331 return -EINTR; 2329 return -EINTR;
2332 } 2330 }
2333 2331
2334 if (err) { 2332 if (err) {
2335 BT_ERR("%s: Device boot timeout", hdev->name); 2333 bt_dev_err(hdev, "Device boot timeout");
2336 return -ETIMEDOUT; 2334 return -ETIMEDOUT;
2337 } 2335 }
2338 2336
@@ -2392,8 +2390,7 @@ static int btusb_shutdown_intel(struct hci_dev *hdev)
2392 skb = __hci_cmd_sync(hdev, 0xfc3f, 0, NULL, HCI_INIT_TIMEOUT); 2390 skb = __hci_cmd_sync(hdev, 0xfc3f, 0, NULL, HCI_INIT_TIMEOUT);
2393 if (IS_ERR(skb)) { 2391 if (IS_ERR(skb)) {
2394 ret = PTR_ERR(skb); 2392 ret = PTR_ERR(skb);
2395 BT_ERR("%s: turning off Intel device LED failed (%ld)", 2393 bt_dev_err(hdev, "turning off Intel device LED failed");
2396 hdev->name, ret);
2397 return ret; 2394 return ret;
2398 } 2395 }
2399 kfree_skb(skb); 2396 kfree_skb(skb);