mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
Merge "Bluetooth: Use bt_dev_err and bt_dev_info when possible" into odroidg12-4.9.y-android
This commit is contained in:
@@ -117,7 +117,7 @@ static void bpa10x_rx_complete(struct urb *urb)
|
||||
bpa10x_recv_pkts,
|
||||
ARRAY_SIZE(bpa10x_recv_pkts));
|
||||
if (IS_ERR(data->rx_skb[idx])) {
|
||||
BT_ERR("%s corrupted event packet", hdev->name);
|
||||
bt_dev_err(hdev, "corrupted event packet");
|
||||
hdev->stat.err_rx++;
|
||||
data->rx_skb[idx] = NULL;
|
||||
}
|
||||
@@ -127,8 +127,7 @@ static void bpa10x_rx_complete(struct urb *urb)
|
||||
|
||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s urb %p failed to resubmit (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p failed to resubmit (%d)", urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
}
|
||||
@@ -164,8 +163,7 @@ static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev)
|
||||
|
||||
err = usb_submit_urb(urb, GFP_KERNEL);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s urb %p submission failed (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p submission failed (%d)", urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
|
||||
@@ -205,8 +203,7 @@ static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev)
|
||||
|
||||
err = usb_submit_urb(urb, GFP_KERNEL);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s urb %p submission failed (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p submission failed (%d)", urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
|
||||
@@ -272,7 +269,7 @@ static int bpa10x_setup(struct hci_dev *hdev)
|
||||
if (IS_ERR(skb))
|
||||
return PTR_ERR(skb);
|
||||
|
||||
BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));
|
||||
bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
|
||||
|
||||
hci_set_fw_info(hdev, "%s", skb->data + 1);
|
||||
|
||||
@@ -348,7 +345,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
|
||||
err = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s urb %p submission failed", hdev->name, urb);
|
||||
bt_dev_err(hdev, "urb %p submission failed", urb);
|
||||
kfree(urb->setup_packet);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
|
||||
} else if ((stat & 0xff) != 0xff) {
|
||||
if (stat & 0x0020) {
|
||||
int status = bt3c_read(iobase, 0x7002) & 0x10;
|
||||
BT_INFO("%s: Antenna %s", info->hdev->name,
|
||||
bt_dev_info(info->hdev, "Antenna %s",
|
||||
status ? "out" : "in");
|
||||
}
|
||||
if (stat & 0x0001)
|
||||
|
||||
@@ -45,13 +45,12 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
|
||||
HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
int err = PTR_ERR(skb);
|
||||
BT_ERR("%s: BCM: Reading device address failed (%d)",
|
||||
hdev->name, err);
|
||||
bt_dev_err(hdev, "BCM: Reading device address failed (%d)", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (skb->len != sizeof(*bda)) {
|
||||
BT_ERR("%s: BCM: Device address length mismatch", hdev->name);
|
||||
bt_dev_err(hdev, "BCM: Device address length mismatch");
|
||||
kfree_skb(skb);
|
||||
return -EIO;
|
||||
}
|
||||
@@ -74,8 +73,8 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
|
||||
if (!bacmp(&bda->bdaddr, BDADDR_BCM20702A0) ||
|
||||
!bacmp(&bda->bdaddr, BDADDR_BCM4324B3) ||
|
||||
!bacmp(&bda->bdaddr, BDADDR_BCM4330B1)) {
|
||||
BT_INFO("%s: BCM: Using default device address (%pMR)",
|
||||
hdev->name, &bda->bdaddr);
|
||||
bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
|
||||
&bda->bdaddr);
|
||||
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
|
||||
}
|
||||
|
||||
@@ -93,8 +92,7 @@ int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
|
||||
skb = __hci_cmd_sync(hdev, 0xfc01, 6, bdaddr, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
err = PTR_ERR(skb);
|
||||
BT_ERR("%s: BCM: Change address command failed (%d)",
|
||||
hdev->name, err);
|
||||
bt_dev_err(hdev, "BCM: Change address command failed (%d)", err);
|
||||
return err;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
@@ -116,8 +114,8 @@ int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw)
|
||||
skb = __hci_cmd_sync(hdev, 0xfc2e, 0, NULL, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
err = PTR_ERR(skb);
|
||||
BT_ERR("%s: BCM: Download Minidrv command failed (%d)",
|
||||
hdev->name, err);
|
||||
bt_dev_err(hdev, "BCM: Download Minidrv command failed (%d)",
|
||||
err);
|
||||
goto done;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
@@ -136,7 +134,7 @@ int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw)
|
||||
fw_size -= sizeof(*cmd);
|
||||
|
||||
if (fw_size < cmd->plen) {
|
||||
BT_ERR("%s: BCM: Patch is corrupted", hdev->name);
|
||||
bt_dev_err(hdev, "BCM: Patch is corrupted");
|
||||
err = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
@@ -151,8 +149,8 @@ int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw)
|
||||
HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
err = PTR_ERR(skb);
|
||||
BT_ERR("%s: BCM: Patch command %04x failed (%d)",
|
||||
hdev->name, opcode, err);
|
||||
bt_dev_err(hdev, "BCM: Patch command %04x failed (%d)",
|
||||
opcode, err);
|
||||
goto done;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
@@ -173,7 +171,7 @@ static int btbcm_reset(struct hci_dev *hdev)
|
||||
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
int err = PTR_ERR(skb);
|
||||
BT_ERR("%s: BCM: Reset failed (%d)", hdev->name, err);
|
||||
bt_dev_err(hdev, "BCM: Reset failed (%d)", err);
|
||||
return err;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
@@ -188,13 +186,13 @@ static struct sk_buff *btbcm_read_local_name(struct hci_dev *hdev)
|
||||
skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_NAME, 0, NULL,
|
||||
HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
BT_ERR("%s: BCM: Reading local name failed (%ld)",
|
||||
hdev->name, PTR_ERR(skb));
|
||||
bt_dev_err(hdev, "BCM: Reading local name failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return skb;
|
||||
}
|
||||
|
||||
if (skb->len != sizeof(struct hci_rp_read_local_name)) {
|
||||
BT_ERR("%s: BCM: Local name length mismatch", hdev->name);
|
||||
bt_dev_err(hdev, "BCM: Local name length mismatch");
|
||||
kfree_skb(skb);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
@@ -209,13 +207,13 @@ static struct sk_buff *btbcm_read_local_version(struct hci_dev *hdev)
|
||||
skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,
|
||||
HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
BT_ERR("%s: BCM: Reading local version info failed (%ld)",
|
||||
hdev->name, PTR_ERR(skb));
|
||||
bt_dev_err(hdev, "BCM: Reading local version info failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return skb;
|
||||
}
|
||||
|
||||
if (skb->len != sizeof(struct hci_rp_read_local_version)) {
|
||||
BT_ERR("%s: BCM: Local version length mismatch", hdev->name);
|
||||
bt_dev_err(hdev, "BCM: Local version length mismatch");
|
||||
kfree_skb(skb);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
@@ -229,13 +227,13 @@ static struct sk_buff *btbcm_read_verbose_config(struct hci_dev *hdev)
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc79, 0, NULL, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
BT_ERR("%s: BCM: Read verbose config info failed (%ld)",
|
||||
hdev->name, PTR_ERR(skb));
|
||||
bt_dev_err(hdev, "BCM: Read verbose config info failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return skb;
|
||||
}
|
||||
|
||||
if (skb->len != 7) {
|
||||
BT_ERR("%s: BCM: Verbose config length mismatch", hdev->name);
|
||||
bt_dev_err(hdev, "BCM: Verbose config length mismatch");
|
||||
kfree_skb(skb);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
@@ -249,13 +247,13 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc5a, 0, NULL, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
BT_ERR("%s: BCM: Read USB product info failed (%ld)",
|
||||
hdev->name, PTR_ERR(skb));
|
||||
bt_dev_err(hdev, "BCM: Read USB product info failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return skb;
|
||||
}
|
||||
|
||||
if (skb->len != 5) {
|
||||
BT_ERR("%s: BCM: USB product length mismatch", hdev->name);
|
||||
bt_dev_err(hdev, "BCM: USB product length mismatch");
|
||||
kfree_skb(skb);
|
||||
return ERR_PTR(-EIO);
|
||||
}
|
||||
@@ -322,9 +320,9 @@ int btbcm_initialize(struct hci_dev *hdev, char *fw_name, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
|
||||
hw_name ? : "BCM", (subver & 0xe000) >> 13,
|
||||
(subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
|
||||
bt_dev_info(hdev, "%s (%3.3u.%3.3u.%3.3u) build %4.4u",
|
||||
hw_name ? : "BCM", (subver & 0xe000) >> 13,
|
||||
(subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -352,9 +350,9 @@ int btbcm_finalize(struct hci_dev *hdev)
|
||||
subver = le16_to_cpu(ver->lmp_subver);
|
||||
kfree_skb(skb);
|
||||
|
||||
BT_INFO("%s: BCM (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
|
||||
(subver & 0xe000) >> 13, (subver & 0x1f00) >> 8,
|
||||
(subver & 0x00ff), rev & 0x0fff);
|
||||
bt_dev_info(hdev, "BCM (%3.3u.%3.3u.%3.3u) build %4.4u",
|
||||
(subver & 0xe000) >> 13, (subver & 0x1f00) >> 8,
|
||||
(subver & 0x00ff), rev & 0x0fff);
|
||||
|
||||
btbcm_check_bdaddr(hdev);
|
||||
|
||||
@@ -460,13 +458,13 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
|
||||
hw_name ? : "BCM", (subver & 0xe000) >> 13,
|
||||
(subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
|
||||
bt_dev_info(hdev, "%s (%3.3u.%3.3u.%3.3u) build %4.4u",
|
||||
hw_name ? : "BCM", (subver & 0xe000) >> 13,
|
||||
(subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
|
||||
|
||||
err = request_firmware(&fw, fw_name, &hdev->dev);
|
||||
if (err < 0) {
|
||||
BT_INFO("%s: BCM: Patch %s not found", hdev->name, fw_name);
|
||||
bt_dev_info(hdev, "BCM: Patch %s not found", fw_name);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -489,16 +487,16 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
|
||||
subver = le16_to_cpu(ver->lmp_subver);
|
||||
kfree_skb(skb);
|
||||
|
||||
BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
|
||||
hw_name ? : "BCM", (subver & 0xe000) >> 13,
|
||||
(subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
|
||||
bt_dev_info(hdev, "%s (%3.3u.%3.3u.%3.3u) build %4.4u",
|
||||
hw_name ? : "BCM", (subver & 0xe000) >> 13,
|
||||
(subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
|
||||
|
||||
/* Read Local Name */
|
||||
skb = btbcm_read_local_name(hdev);
|
||||
if (IS_ERR(skb))
|
||||
return PTR_ERR(skb);
|
||||
|
||||
BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));
|
||||
bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
|
||||
kfree_skb(skb);
|
||||
|
||||
done:
|
||||
@@ -523,24 +521,24 @@ int btbcm_setup_apple(struct hci_dev *hdev)
|
||||
/* Read Verbose Config Version Info */
|
||||
skb = btbcm_read_verbose_config(hdev);
|
||||
if (!IS_ERR(skb)) {
|
||||
BT_INFO("%s: BCM: chip id %u build %4.4u", hdev->name,
|
||||
skb->data[1], get_unaligned_le16(skb->data + 5));
|
||||
bt_dev_info(hdev, "BCM: chip id %u build %4.4u",
|
||||
skb->data[1], get_unaligned_le16(skb->data + 5));
|
||||
kfree_skb(skb);
|
||||
}
|
||||
|
||||
/* Read USB Product Info */
|
||||
skb = btbcm_read_usb_product(hdev);
|
||||
if (!IS_ERR(skb)) {
|
||||
BT_INFO("%s: BCM: product %4.4x:%4.4x", hdev->name,
|
||||
get_unaligned_le16(skb->data + 1),
|
||||
get_unaligned_le16(skb->data + 3));
|
||||
bt_dev_info(hdev, "BCM: product %4.4x:%4.4x",
|
||||
get_unaligned_le16(skb->data + 1),
|
||||
get_unaligned_le16(skb->data + 3));
|
||||
kfree_skb(skb);
|
||||
}
|
||||
|
||||
/* Read Local Name */
|
||||
skb = btbcm_read_local_name(hdev);
|
||||
if (!IS_ERR(skb)) {
|
||||
BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));
|
||||
bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
|
||||
kfree_skb(skb);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,13 +43,13 @@ int btintel_check_bdaddr(struct hci_dev *hdev)
|
||||
HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
int err = PTR_ERR(skb);
|
||||
BT_ERR("%s: Reading Intel device address failed (%d)",
|
||||
hdev->name, err);
|
||||
bt_dev_err(hdev, "Reading Intel device address failed (%d)",
|
||||
err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (skb->len != sizeof(*bda)) {
|
||||
BT_ERR("%s: Intel device address length mismatch", hdev->name);
|
||||
bt_dev_err(hdev, "Intel device address length mismatch");
|
||||
kfree_skb(skb);
|
||||
return -EIO;
|
||||
}
|
||||
@@ -62,8 +62,8 @@ int btintel_check_bdaddr(struct hci_dev *hdev)
|
||||
* and that in turn can cause problems with Bluetooth operation.
|
||||
*/
|
||||
if (!bacmp(&bda->bdaddr, BDADDR_INTEL)) {
|
||||
BT_ERR("%s: Found Intel default device address (%pMR)",
|
||||
hdev->name, &bda->bdaddr);
|
||||
bt_dev_err(hdev, "Found Intel default device address (%pMR)",
|
||||
&bda->bdaddr);
|
||||
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
|
||||
skb = __hci_cmd_sync(hdev, 0xfc31, 6, bdaddr, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
err = PTR_ERR(skb);
|
||||
BT_ERR("%s: Changing Intel device address failed (%d)",
|
||||
hdev->name, err);
|
||||
bt_dev_err(hdev, "Changing Intel device address failed (%d)",
|
||||
err);
|
||||
return err;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
@@ -154,8 +154,8 @@ int btintel_set_diag(struct hci_dev *hdev, bool enable)
|
||||
err = PTR_ERR(skb);
|
||||
if (err == -ENODATA)
|
||||
goto done;
|
||||
BT_ERR("%s: Changing Intel diagnostic mode failed (%d)",
|
||||
hdev->name, err);
|
||||
bt_dev_err(hdev, "Changing Intel diagnostic mode failed (%d)",
|
||||
err);
|
||||
return err;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
@@ -189,30 +189,30 @@ void btintel_hw_error(struct hci_dev *hdev, u8 code)
|
||||
struct sk_buff *skb;
|
||||
u8 type = 0x00;
|
||||
|
||||
BT_ERR("%s: Hardware error 0x%2.2x", hdev->name, code);
|
||||
bt_dev_err(hdev, "Hardware error 0x%2.2x", code);
|
||||
|
||||
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
BT_ERR("%s: Reset after hardware error failed (%ld)",
|
||||
hdev->name, PTR_ERR(skb));
|
||||
bt_dev_err(hdev, "Reset after hardware error failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc22, 1, &type, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
BT_ERR("%s: Retrieving Intel exception info failed (%ld)",
|
||||
hdev->name, PTR_ERR(skb));
|
||||
bt_dev_err(hdev, "Retrieving Intel exception info failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return;
|
||||
}
|
||||
|
||||
if (skb->len != 13) {
|
||||
BT_ERR("%s: Exception info size mismatch", hdev->name);
|
||||
bt_dev_err(hdev, "Exception info size mismatch");
|
||||
kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
|
||||
BT_ERR("%s: Exception info %s", hdev->name, (char *)(skb->data + 1));
|
||||
bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1));
|
||||
|
||||
kfree_skb(skb);
|
||||
}
|
||||
@@ -233,9 +233,10 @@ void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver)
|
||||
return;
|
||||
}
|
||||
|
||||
BT_INFO("%s: %s revision %u.%u build %u week %u %u", hdev->name,
|
||||
variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f,
|
||||
ver->fw_build_num, ver->fw_build_ww, 2000 + ver->fw_build_yy);
|
||||
bt_dev_info(hdev, "%s revision %u.%u build %u week %u %u",
|
||||
variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f,
|
||||
ver->fw_build_num, ver->fw_build_ww,
|
||||
2000 + ver->fw_build_yy);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(btintel_version_info);
|
||||
|
||||
@@ -321,8 +322,7 @@ int btintel_set_event_mask(struct hci_dev *hdev, bool debug)
|
||||
skb = __hci_cmd_sync(hdev, 0xfc52, 8, mask, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
err = PTR_ERR(skb);
|
||||
BT_ERR("%s: Setting Intel event mask failed (%d)",
|
||||
hdev->name, err);
|
||||
bt_dev_err(hdev, "Setting Intel event mask failed (%d)", err);
|
||||
return err;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
|
||||
@@ -287,7 +287,7 @@ static int rome_download_firmware(struct hci_dev *hdev,
|
||||
const struct firmware *fw;
|
||||
int ret;
|
||||
|
||||
BT_INFO("%s: ROME Downloading %s", hdev->name, config->fwname);
|
||||
bt_dev_info(hdev, "ROME Downloading %s", config->fwname);
|
||||
|
||||
ret = request_firmware(&fw, config->fwname, &hdev->dev);
|
||||
if (ret) {
|
||||
@@ -351,7 +351,7 @@ int qca_uart_setup_rome(struct hci_dev *hdev, uint8_t baudrate)
|
||||
return err;
|
||||
}
|
||||
|
||||
BT_INFO("%s: ROME controller version 0x%08x", hdev->name, rome_ver);
|
||||
bt_dev_info(hdev, "ROME controller version 0x%08x", rome_ver);
|
||||
|
||||
/* Download rampatch file */
|
||||
config.type = TLV_TYPE_PATCH;
|
||||
@@ -380,7 +380,7 @@ int qca_uart_setup_rome(struct hci_dev *hdev, uint8_t baudrate)
|
||||
return err;
|
||||
}
|
||||
|
||||
BT_INFO("%s: ROME setup on UART is completed", hdev->name);
|
||||
bt_dev_info(hdev, "ROME setup on UART is completed");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ static int rtl_read_rom_version(struct hci_dev *hdev, u8 *version)
|
||||
}
|
||||
|
||||
rom_version = (struct rtl_rom_version_evt *)skb->data;
|
||||
BT_INFO("%s: rom_version status=%x version=%x",
|
||||
hdev->name, rom_version->status, rom_version->version);
|
||||
bt_dev_info(hdev, "rom_version status=%x version=%x",
|
||||
rom_version->status, rom_version->version);
|
||||
|
||||
*version = rom_version->version;
|
||||
|
||||
@@ -273,7 +273,7 @@ static int rtl_load_config(struct hci_dev *hdev, const char *name, u8 **buff)
|
||||
const struct firmware *fw;
|
||||
int ret;
|
||||
|
||||
BT_INFO("%s: rtl: loading %s", hdev->name, name);
|
||||
bt_dev_info(hdev, "rtl: loading %s", name);
|
||||
ret = request_firmware(&fw, name, &hdev->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -292,7 +292,7 @@ static int btrtl_setup_rtl8723a(struct hci_dev *hdev)
|
||||
const struct firmware *fw;
|
||||
int ret;
|
||||
|
||||
BT_INFO("%s: rtl: loading rtl_bt/rtl8723a_fw.bin", hdev->name);
|
||||
bt_dev_info(hdev, "rtl: loading rtl_bt/rtl8723a_fw.bin");
|
||||
ret = request_firmware(&fw, "rtl_bt/rtl8723a_fw.bin", &hdev->dev);
|
||||
if (ret < 0) {
|
||||
BT_ERR("%s: Failed to load rtl_bt/rtl8723a_fw.bin", hdev->name);
|
||||
@@ -363,7 +363,7 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev, u16 lmp_subver,
|
||||
} else
|
||||
cfg_sz = 0;
|
||||
|
||||
BT_INFO("%s: rtl: loading %s", hdev->name, fw_name);
|
||||
bt_dev_info(hdev, "rtl: loading %s", fw_name);
|
||||
ret = request_firmware(&fw, fw_name, &hdev->dev);
|
||||
if (ret < 0) {
|
||||
BT_ERR("%s: Failed to load %s", hdev->name, fw_name);
|
||||
@@ -390,7 +390,7 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev, u16 lmp_subver,
|
||||
fw_data = tbuff;
|
||||
}
|
||||
|
||||
BT_INFO("cfg_sz %d, total size %d", cfg_sz, ret);
|
||||
bt_dev_info(hdev, "cfg_sz %d, total size %d", cfg_sz, ret);
|
||||
|
||||
ret = rtl_download_firmware(hdev, fw_data, ret);
|
||||
|
||||
@@ -436,9 +436,10 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
|
||||
return -PTR_ERR(skb);
|
||||
|
||||
resp = (struct hci_rp_read_local_version *)skb->data;
|
||||
BT_INFO("%s: rtl: examining hci_ver=%02x hci_rev=%04x lmp_ver=%02x "
|
||||
"lmp_subver=%04x", hdev->name, resp->hci_ver, resp->hci_rev,
|
||||
resp->lmp_ver, resp->lmp_subver);
|
||||
bt_dev_info(hdev, "rtl: examining hci_ver=%02x hci_rev=%04x "
|
||||
"lmp_ver=%02x lmp_subver=%04x",
|
||||
resp->hci_ver, resp->hci_rev,
|
||||
resp->lmp_ver, resp->lmp_subver);
|
||||
|
||||
lmp_subver = le16_to_cpu(resp->lmp_subver);
|
||||
kfree_skb(skb);
|
||||
@@ -466,7 +467,7 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
|
||||
return btrtl_setup_rtl8723b(hdev, lmp_subver,
|
||||
"rtl_bt/rtl8822b_fw.bin");
|
||||
default:
|
||||
BT_INFO("rtl: assuming no firmware upload needed.");
|
||||
bt_dev_info(hdev, "rtl: assuming no firmware upload needed");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ static void btusb_intr_complete(struct urb *urb)
|
||||
|
||||
if (btusb_recv_intr(data, urb->transfer_buffer,
|
||||
urb->actual_length) < 0) {
|
||||
BT_ERR("%s corrupted event packet", hdev->name);
|
||||
bt_dev_err(hdev, "corrupted event packet");
|
||||
hdev->stat.err_rx++;
|
||||
}
|
||||
} else if (urb->status == -ENOENT) {
|
||||
@@ -648,8 +648,8 @@ static void btusb_intr_complete(struct urb *urb)
|
||||
/* -EPERM: urb is being killed;
|
||||
* -ENODEV: device got disconnected */
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p failed to resubmit (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
|
||||
urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
}
|
||||
@@ -691,8 +691,8 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
|
||||
err = usb_submit_urb(urb, mem_flags);
|
||||
if (err < 0) {
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p submission failed (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p submission failed (%d)",
|
||||
urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
|
||||
@@ -718,7 +718,7 @@ static void btusb_bulk_complete(struct urb *urb)
|
||||
|
||||
if (data->recv_bulk(data, urb->transfer_buffer,
|
||||
urb->actual_length) < 0) {
|
||||
BT_ERR("%s corrupted ACL packet", hdev->name);
|
||||
bt_dev_err(hdev, "corrupted ACL packet");
|
||||
hdev->stat.err_rx++;
|
||||
}
|
||||
} else if (urb->status == -ENOENT) {
|
||||
@@ -737,8 +737,8 @@ static void btusb_bulk_complete(struct urb *urb)
|
||||
/* -EPERM: urb is being killed;
|
||||
* -ENODEV: device got disconnected */
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p failed to resubmit (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
|
||||
urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
}
|
||||
@@ -779,8 +779,8 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags)
|
||||
err = usb_submit_urb(urb, mem_flags);
|
||||
if (err < 0) {
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p submission failed (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p submission failed (%d)",
|
||||
urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
|
||||
@@ -813,7 +813,7 @@ static void btusb_isoc_complete(struct urb *urb)
|
||||
|
||||
if (btusb_recv_isoc(data, urb->transfer_buffer + offset,
|
||||
length) < 0) {
|
||||
BT_ERR("%s corrupted SCO packet", hdev->name);
|
||||
bt_dev_err(hdev, "corrupted SCO packet");
|
||||
hdev->stat.err_rx++;
|
||||
}
|
||||
}
|
||||
@@ -832,8 +832,8 @@ static void btusb_isoc_complete(struct urb *urb)
|
||||
/* -EPERM: urb is being killed;
|
||||
* -ENODEV: device got disconnected */
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p failed to resubmit (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
|
||||
urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
}
|
||||
@@ -900,8 +900,8 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags)
|
||||
err = usb_submit_urb(urb, mem_flags);
|
||||
if (err < 0) {
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p submission failed (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p submission failed (%d)",
|
||||
urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
|
||||
@@ -944,8 +944,8 @@ static void btusb_diag_complete(struct urb *urb)
|
||||
/* -EPERM: urb is being killed;
|
||||
* -ENODEV: device got disconnected */
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p failed to resubmit (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p failed to resubmit (%d)",
|
||||
urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
}
|
||||
@@ -986,8 +986,8 @@ static int btusb_submit_diag_urb(struct hci_dev *hdev, gfp_t mem_flags)
|
||||
err = usb_submit_urb(urb, mem_flags);
|
||||
if (err < 0) {
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p submission failed (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p submission failed (%d)",
|
||||
urb, -err);
|
||||
usb_unanchor_urb(urb);
|
||||
}
|
||||
|
||||
@@ -1243,8 +1243,8 @@ static int submit_tx_urb(struct hci_dev *hdev, struct urb *urb)
|
||||
err = usb_submit_urb(urb, GFP_KERNEL);
|
||||
if (err < 0) {
|
||||
if (err != -EPERM && err != -ENODEV)
|
||||
BT_ERR("%s urb %p submission failed (%d)",
|
||||
hdev->name, urb, -err);
|
||||
bt_dev_err(hdev, "urb %p submission failed (%d)",
|
||||
urb, -err);
|
||||
kfree(urb->setup_packet);
|
||||
usb_unanchor_urb(urb);
|
||||
} else {
|
||||
@@ -1339,7 +1339,7 @@ static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
|
||||
|
||||
err = usb_set_interface(data->udev, 1, altsetting);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s setting interface failed (%d)", hdev->name, -err);
|
||||
bt_dev_err(hdev, "setting interface failed (%d)", -err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1363,7 +1363,7 @@ static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
|
||||
}
|
||||
|
||||
if (!data->isoc_tx_ep || !data->isoc_rx_ep) {
|
||||
BT_ERR("%s invalid SCO descriptors", hdev->name);
|
||||
bt_dev_err(hdev, "invalid SCO descriptors");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -1458,7 +1458,7 @@ static int btusb_setup_bcm92035(struct hci_dev *hdev)
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc3b, 1, &val, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb))
|
||||
BT_ERR("BCM92035 command failed (%ld)", -PTR_ERR(skb));
|
||||
bt_dev_err(hdev, "BCM92035 command failed (%ld)", PTR_ERR(skb));
|
||||
else
|
||||
kfree_skb(skb);
|
||||
|
||||
@@ -1476,12 +1476,12 @@ static int btusb_setup_csr(struct hci_dev *hdev)
|
||||
HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
int err = PTR_ERR(skb);
|
||||
BT_ERR("%s: CSR: Local version failed (%d)", hdev->name, err);
|
||||
bt_dev_err(hdev, "CSR: Local version failed (%d)", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (skb->len != sizeof(struct hci_rp_read_local_version)) {
|
||||
BT_ERR("%s: CSR: Local version length mismatch", hdev->name);
|
||||
bt_dev_err(hdev, "CSR: Local version length mismatch");
|
||||
kfree_skb(skb);
|
||||
return -EIO;
|
||||
}
|
||||
@@ -1543,7 +1543,7 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev,
|
||||
}
|
||||
}
|
||||
|
||||
BT_INFO("%s: Intel Bluetooth firmware file: %s", hdev->name, fwname);
|
||||
bt_dev_info(hdev, "Intel Bluetooth firmware file: %s", fwname);
|
||||
|
||||
return fw;
|
||||
}
|
||||
@@ -1699,18 +1699,18 @@ static int btusb_setup_intel(struct hci_dev *hdev)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
BT_INFO("%s: read Intel version: %02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
hdev->name, ver.hw_platform, ver.hw_variant, ver.hw_revision,
|
||||
ver.fw_variant, ver.fw_revision, ver.fw_build_num,
|
||||
ver.fw_build_ww, ver.fw_build_yy, ver.fw_patch_num);
|
||||
bt_dev_info(hdev, "read Intel version: %02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
ver.hw_platform, ver.hw_variant, ver.hw_revision,
|
||||
ver.fw_variant, ver.fw_revision, ver.fw_build_num,
|
||||
ver.fw_build_ww, ver.fw_build_yy, ver.fw_patch_num);
|
||||
|
||||
/* fw_patch_num indicates the version of patch the device currently
|
||||
* have. If there is no patch data in the device, it is always 0x00.
|
||||
* So, if it is other than 0x00, no need to patch the device again.
|
||||
*/
|
||||
if (ver.fw_patch_num) {
|
||||
BT_INFO("%s: Intel device is already patched. patch num: %02x",
|
||||
hdev->name, ver.fw_patch_num);
|
||||
bt_dev_info(hdev, "Intel device is already patched. "
|
||||
"patch num: %02x", ver.fw_patch_num);
|
||||
goto complete;
|
||||
}
|
||||
|
||||
@@ -1778,8 +1778,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
BT_INFO("%s: Intel Bluetooth firmware patch completed and activated",
|
||||
hdev->name);
|
||||
bt_dev_info(hdev, "Intel firmware patch completed and activated");
|
||||
|
||||
goto complete;
|
||||
|
||||
@@ -1789,7 +1788,7 @@ exit_mfg_disable:
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
BT_INFO("%s: Intel Bluetooth firmware patch completed", hdev->name);
|
||||
bt_dev_info(hdev, "Intel firmware patch completed");
|
||||
|
||||
goto complete;
|
||||
|
||||
@@ -1803,8 +1802,7 @@ exit_mfg_deactivate:
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
BT_INFO("%s: Intel Bluetooth firmware patch completed and deactivated",
|
||||
hdev->name);
|
||||
bt_dev_info(hdev, "Intel firmware patch completed and deactivated");
|
||||
|
||||
complete:
|
||||
/* Set the event mask for Intel specific vendor events. This enables
|
||||
@@ -2079,24 +2077,24 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
|
||||
|
||||
params = (struct intel_boot_params *)skb->data;
|
||||
|
||||
BT_INFO("%s: Device revision is %u", hdev->name,
|
||||
le16_to_cpu(params->dev_revid));
|
||||
bt_dev_info(hdev, "Device revision is %u",
|
||||
le16_to_cpu(params->dev_revid));
|
||||
|
||||
BT_INFO("%s: Secure boot is %s", hdev->name,
|
||||
params->secure_boot ? "enabled" : "disabled");
|
||||
bt_dev_info(hdev, "Secure boot is %s",
|
||||
params->secure_boot ? "enabled" : "disabled");
|
||||
|
||||
BT_INFO("%s: OTP lock is %s", hdev->name,
|
||||
params->otp_lock ? "enabled" : "disabled");
|
||||
bt_dev_info(hdev, "OTP lock is %s",
|
||||
params->otp_lock ? "enabled" : "disabled");
|
||||
|
||||
BT_INFO("%s: API lock is %s", hdev->name,
|
||||
params->api_lock ? "enabled" : "disabled");
|
||||
bt_dev_info(hdev, "API lock is %s",
|
||||
params->api_lock ? "enabled" : "disabled");
|
||||
|
||||
BT_INFO("%s: Debug lock is %s", hdev->name,
|
||||
params->debug_lock ? "enabled" : "disabled");
|
||||
bt_dev_info(hdev, "Debug lock is %s",
|
||||
params->debug_lock ? "enabled" : "disabled");
|
||||
|
||||
BT_INFO("%s: Minimum firmware build %u week %u %u", hdev->name,
|
||||
params->min_fw_build_nn, params->min_fw_build_cw,
|
||||
2000 + params->min_fw_build_yy);
|
||||
bt_dev_info(hdev, "Minimum firmware build %u week %u %u",
|
||||
params->min_fw_build_nn, params->min_fw_build_cw,
|
||||
2000 + params->min_fw_build_yy);
|
||||
|
||||
/* It is required that every single firmware fragment is acknowledged
|
||||
* with a command complete event. If the boot parameters indicate
|
||||
@@ -2113,7 +2111,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
|
||||
* also be no valid address for the operational firmware.
|
||||
*/
|
||||
if (!bacmp(¶ms->otp_bdaddr, BDADDR_ANY)) {
|
||||
BT_INFO("%s: No device address configured", hdev->name);
|
||||
bt_dev_info(hdev, "No device address configured");
|
||||
set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
|
||||
}
|
||||
|
||||
@@ -2138,7 +2136,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
|
||||
return err;
|
||||
}
|
||||
|
||||
BT_INFO("%s: Found device firmware: %s", hdev->name, fwname);
|
||||
bt_dev_info(hdev, "Found device firmware: %s", fwname);
|
||||
|
||||
/* Save the DDC file name for later use to apply once the firmware
|
||||
* downloading is done.
|
||||
@@ -2219,7 +2217,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
|
||||
|
||||
set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
|
||||
|
||||
BT_INFO("%s: Waiting for firmware download to complete", hdev->name);
|
||||
bt_dev_info(hdev, "Waiting for firmware download to complete");
|
||||
|
||||
/* Before switching the device into operational mode and with that
|
||||
* booting the loaded firmware, wait for the bootloader notification
|
||||
@@ -2256,7 +2254,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
|
||||
delta = ktime_sub(rettime, calltime);
|
||||
duration = (unsigned long long) ktime_to_ns(delta) >> 10;
|
||||
|
||||
BT_INFO("%s: Firmware loaded in %llu usecs", hdev->name, duration);
|
||||
bt_dev_info(hdev, "Firmware loaded in %llu usecs", duration);
|
||||
|
||||
done:
|
||||
release_firmware(fw);
|
||||
@@ -2282,7 +2280,7 @@ done:
|
||||
* 1 second. However if that happens, then just fail the setup
|
||||
* since something went wrong.
|
||||
*/
|
||||
BT_INFO("%s: Waiting for device to boot", hdev->name);
|
||||
bt_dev_info(hdev, "Waiting for device to boot");
|
||||
|
||||
err = wait_on_bit_timeout(&data->flags, BTUSB_BOOTING,
|
||||
TASK_INTERRUPTIBLE,
|
||||
@@ -2302,7 +2300,7 @@ done:
|
||||
delta = ktime_sub(rettime, calltime);
|
||||
duration = (unsigned long long) ktime_to_ns(delta) >> 10;
|
||||
|
||||
BT_INFO("%s: Device booted in %llu usecs", hdev->name, duration);
|
||||
bt_dev_info(hdev, "Device booted in %llu usecs", duration);
|
||||
|
||||
clear_bit(BTUSB_BOOTLOADER, &data->flags);
|
||||
|
||||
@@ -2361,8 +2359,8 @@ static int btusb_set_bdaddr_marvell(struct hci_dev *hdev,
|
||||
skb = __hci_cmd_sync(hdev, 0xfc22, sizeof(buf), buf, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
ret = PTR_ERR(skb);
|
||||
BT_ERR("%s: changing Marvell device address failed (%ld)",
|
||||
hdev->name, ret);
|
||||
bt_dev_err(hdev, "changing Marvell device address failed (%ld)",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
@@ -2386,8 +2384,7 @@ static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev,
|
||||
skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
ret = PTR_ERR(skb);
|
||||
BT_ERR("%s: Change address command failed (%ld)",
|
||||
hdev->name, ret);
|
||||
bt_dev_err(hdev, "Change address command failed (%ld)", ret);
|
||||
return ret;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
@@ -2453,7 +2450,7 @@ static int btusb_qca_send_vendor_req(struct hci_dev *hdev, u8 request,
|
||||
err = usb_control_msg(udev, pipe, request, USB_TYPE_VENDOR | USB_DIR_IN,
|
||||
0, 0, buf, size, USB_CTRL_SET_TIMEOUT);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s: Failed to access otp area (%d)", hdev->name, err);
|
||||
bt_dev_err(hdev, "Failed to access otp area (%d)", err);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2493,7 +2490,7 @@ static int btusb_setup_qca_download_fw(struct hci_dev *hdev,
|
||||
err = usb_control_msg(udev, pipe, QCA_DFU_DOWNLOAD, USB_TYPE_VENDOR,
|
||||
0, 0, buf, size, USB_CTRL_SET_TIMEOUT);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s: Failed to send headers (%d)", hdev->name, err);
|
||||
bt_dev_err(hdev, "Failed to send headers (%d)", err);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2509,13 +2506,13 @@ static int btusb_setup_qca_download_fw(struct hci_dev *hdev,
|
||||
err = usb_bulk_msg(udev, pipe, buf, size, &len,
|
||||
QCA_DFU_TIMEOUT);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s: Failed to send body at %zd of %zd (%d)",
|
||||
hdev->name, sent, firmware->size, err);
|
||||
bt_dev_err(hdev, "Failed to send body at %zd of %zd (%d)",
|
||||
sent, firmware->size, err);
|
||||
break;
|
||||
}
|
||||
|
||||
if (size != len) {
|
||||
BT_ERR("%s: Failed to get bulk buffer", hdev->name);
|
||||
bt_dev_err(hdev, "Failed to get bulk buffer");
|
||||
err = -EILSEQ;
|
||||
break;
|
||||
}
|
||||
@@ -2547,24 +2544,23 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev,
|
||||
|
||||
err = request_firmware(&fw, fwname, &hdev->dev);
|
||||
if (err) {
|
||||
BT_ERR("%s: failed to request rampatch file: %s (%d)",
|
||||
hdev->name, fwname, err);
|
||||
bt_dev_err(hdev, "failed to request rampatch file: %s (%d)",
|
||||
fwname, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
BT_INFO("%s: using rampatch file: %s", hdev->name, fwname);
|
||||
bt_dev_info(hdev, "using rampatch file: %s", fwname);
|
||||
|
||||
rver = (struct qca_rampatch_version *)(fw->data + info->ver_offset);
|
||||
rver_rom = le16_to_cpu(rver->rom_version);
|
||||
rver_patch = le16_to_cpu(rver->patch_version);
|
||||
|
||||
BT_INFO("%s: QCA: patch rome 0x%x build 0x%x, firmware rome 0x%x "
|
||||
"build 0x%x", hdev->name, rver_rom, rver_patch, ver_rom,
|
||||
ver_patch);
|
||||
bt_dev_info(hdev, "QCA: patch rome 0x%x build 0x%x, "
|
||||
"firmware rome 0x%x build 0x%x",
|
||||
rver_rom, rver_patch, ver_rom, ver_patch);
|
||||
|
||||
if (rver_rom != ver_rom || rver_patch <= ver_patch) {
|
||||
BT_ERR("%s: rampatch file version did not match with firmware",
|
||||
hdev->name);
|
||||
bt_dev_err(hdev, "rampatch file version did not match with firmware");
|
||||
err = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
@@ -2590,12 +2586,12 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
|
||||
|
||||
err = request_firmware(&fw, fwname, &hdev->dev);
|
||||
if (err) {
|
||||
BT_ERR("%s: failed to request NVM file: %s (%d)",
|
||||
hdev->name, fwname, err);
|
||||
bt_dev_err(hdev, "failed to request NVM file: %s (%d)",
|
||||
fwname, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
BT_INFO("%s: using NVM file: %s", hdev->name, fwname);
|
||||
bt_dev_info(hdev, "using NVM file: %s", fwname);
|
||||
|
||||
err = btusb_setup_qca_download_fw(hdev, fw, info->nvm_hdr);
|
||||
|
||||
@@ -2623,8 +2619,7 @@ static int btusb_setup_qca(struct hci_dev *hdev)
|
||||
info = &qca_devices_table[i];
|
||||
}
|
||||
if (!info) {
|
||||
BT_ERR("%s: don't support firmware rome 0x%x", hdev->name,
|
||||
ver_rom);
|
||||
bt_dev_err(hdev, "don't support firmware rome 0x%x", ver_rom);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -2678,7 +2673,7 @@ static inline int __set_diag_interface(struct hci_dev *hdev)
|
||||
}
|
||||
|
||||
if (!data->diag_tx_ep || !data->diag_rx_ep) {
|
||||
BT_ERR("%s invalid diagnostic descriptors", hdev->name);
|
||||
bt_dev_err(hdev, "invalid diagnostic descriptors");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ static int ath_recv(struct hci_uart *hu, const void *data, int count)
|
||||
ath_recv_pkts, ARRAY_SIZE(ath_recv_pkts));
|
||||
if (IS_ERR(ath->rx_skb)) {
|
||||
int err = PTR_ERR(ath->rx_skb);
|
||||
BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err);
|
||||
bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
|
||||
ath->rx_skb = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ static int h4_recv(struct hci_uart *hu, const void *data, int count)
|
||||
h4_recv_pkts, ARRAY_SIZE(h4_recv_pkts));
|
||||
if (IS_ERR(h4->rx_skb)) {
|
||||
int err = PTR_ERR(h4->rx_skb);
|
||||
BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err);
|
||||
bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
|
||||
h4->rx_skb = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -804,7 +804,7 @@ static int qca_recv(struct hci_uart *hu, const void *data, int count)
|
||||
qca_recv_pkts, ARRAY_SIZE(qca_recv_pkts));
|
||||
if (IS_ERR(qca->rx_skb)) {
|
||||
int err = PTR_ERR(qca->rx_skb);
|
||||
BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err);
|
||||
bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
|
||||
qca->rx_skb = NULL;
|
||||
return err;
|
||||
}
|
||||
@@ -867,7 +867,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
|
||||
|
||||
skb = bt_skb_alloc(sizeof(cmd), GFP_ATOMIC);
|
||||
if (!skb) {
|
||||
BT_ERR("Failed to allocate memory for baudrate packet");
|
||||
bt_dev_err(hdev, "Failed to allocate baudrate packet");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ static int qca_setup(struct hci_uart *hu)
|
||||
unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
|
||||
int ret;
|
||||
|
||||
BT_INFO("%s: ROME setup", hdev->name);
|
||||
bt_dev_info(hdev, "ROME setup");
|
||||
|
||||
/* Patch downloading has to be done without IBS mode */
|
||||
clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
|
||||
@@ -921,11 +921,11 @@ static int qca_setup(struct hci_uart *hu)
|
||||
if (speed) {
|
||||
qca_baudrate = qca_get_baudrate_value(speed);
|
||||
|
||||
BT_INFO("%s: Set UART speed to %d", hdev->name, speed);
|
||||
bt_dev_info(hdev, "Set UART speed to %d", speed);
|
||||
ret = qca_set_baudrate(hdev, qca_baudrate);
|
||||
if (ret) {
|
||||
BT_ERR("%s: Failed to change the baud rate (%d)",
|
||||
hdev->name, ret);
|
||||
bt_dev_err(hdev, "Failed to change the baud rate (%d)",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
hci_uart_set_baudrate(hu, speed);
|
||||
|
||||
368
drivers/bluetooth/hci_serdev.c
Normal file
368
drivers/bluetooth/hci_serdev.c
Normal file
@@ -0,0 +1,368 @@
|
||||
/*
|
||||
* Bluetooth HCI serdev driver lib
|
||||
*
|
||||
* Copyright (C) 2017 Linaro, Ltd., Rob Herring <robh@kernel.org>
|
||||
*
|
||||
* Based on hci_ldisc.c:
|
||||
*
|
||||
* Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/serdev.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
|
||||
#include "hci_uart.h"
|
||||
|
||||
static struct serdev_device_ops hci_serdev_client_ops;
|
||||
|
||||
static inline void hci_uart_tx_complete(struct hci_uart *hu, int pkt_type)
|
||||
{
|
||||
struct hci_dev *hdev = hu->hdev;
|
||||
|
||||
/* Update HCI stat counters */
|
||||
switch (pkt_type) {
|
||||
case HCI_COMMAND_PKT:
|
||||
hdev->stat.cmd_tx++;
|
||||
break;
|
||||
|
||||
case HCI_ACLDATA_PKT:
|
||||
hdev->stat.acl_tx++;
|
||||
break;
|
||||
|
||||
case HCI_SCODATA_PKT:
|
||||
hdev->stat.sco_tx++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu)
|
||||
{
|
||||
struct sk_buff *skb = hu->tx_skb;
|
||||
|
||||
if (!skb)
|
||||
skb = hu->proto->dequeue(hu);
|
||||
else
|
||||
hu->tx_skb = NULL;
|
||||
|
||||
return skb;
|
||||
}
|
||||
|
||||
static void hci_uart_write_work(struct work_struct *work)
|
||||
{
|
||||
struct hci_uart *hu = container_of(work, struct hci_uart, write_work);
|
||||
struct serdev_device *serdev = hu->serdev;
|
||||
struct hci_dev *hdev = hu->hdev;
|
||||
struct sk_buff *skb;
|
||||
|
||||
/* REVISIT:
|
||||
* should we cope with bad skbs or ->write() returning an error value?
|
||||
*/
|
||||
do {
|
||||
clear_bit(HCI_UART_TX_WAKEUP, &hu->tx_state);
|
||||
|
||||
while ((skb = hci_uart_dequeue(hu))) {
|
||||
int len;
|
||||
|
||||
len = serdev_device_write_buf(serdev,
|
||||
skb->data, skb->len);
|
||||
hdev->stat.byte_tx += len;
|
||||
|
||||
skb_pull(skb, len);
|
||||
if (skb->len) {
|
||||
hu->tx_skb = skb;
|
||||
break;
|
||||
}
|
||||
|
||||
hci_uart_tx_complete(hu, hci_skb_pkt_type(skb));
|
||||
kfree_skb(skb);
|
||||
}
|
||||
} while(test_bit(HCI_UART_TX_WAKEUP, &hu->tx_state));
|
||||
|
||||
clear_bit(HCI_UART_SENDING, &hu->tx_state);
|
||||
}
|
||||
|
||||
/* ------- Interface to HCI layer ------ */
|
||||
|
||||
/* Initialize device */
|
||||
static int hci_uart_open(struct hci_dev *hdev)
|
||||
{
|
||||
BT_DBG("%s %p", hdev->name, hdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reset device */
|
||||
static int hci_uart_flush(struct hci_dev *hdev)
|
||||
{
|
||||
struct hci_uart *hu = hci_get_drvdata(hdev);
|
||||
|
||||
BT_DBG("hdev %p serdev %p", hdev, hu->serdev);
|
||||
|
||||
if (hu->tx_skb) {
|
||||
kfree_skb(hu->tx_skb); hu->tx_skb = NULL;
|
||||
}
|
||||
|
||||
/* Flush any pending characters in the driver and discipline. */
|
||||
serdev_device_write_flush(hu->serdev);
|
||||
|
||||
if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
|
||||
hu->proto->flush(hu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Close device */
|
||||
static int hci_uart_close(struct hci_dev *hdev)
|
||||
{
|
||||
BT_DBG("hdev %p", hdev);
|
||||
|
||||
hci_uart_flush(hdev);
|
||||
hdev->flush = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Send frames from HCI layer */
|
||||
static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
{
|
||||
struct hci_uart *hu = hci_get_drvdata(hdev);
|
||||
|
||||
BT_DBG("%s: type %d len %d", hdev->name, hci_skb_pkt_type(skb),
|
||||
skb->len);
|
||||
|
||||
hu->proto->enqueue(hu, skb);
|
||||
|
||||
hci_uart_tx_wakeup(hu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hci_uart_setup(struct hci_dev *hdev)
|
||||
{
|
||||
struct hci_uart *hu = hci_get_drvdata(hdev);
|
||||
struct hci_rp_read_local_version *ver;
|
||||
struct sk_buff *skb;
|
||||
unsigned int speed;
|
||||
int err;
|
||||
|
||||
/* Init speed if any */
|
||||
if (hu->init_speed)
|
||||
speed = hu->init_speed;
|
||||
else if (hu->proto->init_speed)
|
||||
speed = hu->proto->init_speed;
|
||||
else
|
||||
speed = 0;
|
||||
|
||||
if (speed)
|
||||
serdev_device_set_baudrate(hu->serdev, speed);
|
||||
|
||||
/* Operational speed if any */
|
||||
if (hu->oper_speed)
|
||||
speed = hu->oper_speed;
|
||||
else if (hu->proto->oper_speed)
|
||||
speed = hu->proto->oper_speed;
|
||||
else
|
||||
speed = 0;
|
||||
|
||||
if (hu->proto->set_baudrate && speed) {
|
||||
err = hu->proto->set_baudrate(hu, speed);
|
||||
if (err)
|
||||
bt_dev_err(hdev, "Failed to set baudrate");
|
||||
else
|
||||
serdev_device_set_baudrate(hu->serdev, speed);
|
||||
}
|
||||
|
||||
if (hu->proto->setup)
|
||||
return hu->proto->setup(hu);
|
||||
|
||||
if (!test_bit(HCI_UART_VND_DETECT, &hu->hdev_flags))
|
||||
return 0;
|
||||
|
||||
skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL,
|
||||
HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
bt_dev_err(hdev, "Reading local version info failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (skb->len != sizeof(*ver)) {
|
||||
bt_dev_err(hdev, "Event length mismatch for version info");
|
||||
}
|
||||
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** hci_uart_write_wakeup - transmit buffer wakeup
|
||||
* @serdev: serial device
|
||||
*
|
||||
* This function is called by the serdev framework when it accepts
|
||||
* more data being sent.
|
||||
*/
|
||||
static void hci_uart_write_wakeup(struct serdev_device *serdev)
|
||||
{
|
||||
struct hci_uart *hu = serdev_device_get_drvdata(serdev);
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
if (!hu || serdev != hu->serdev) {
|
||||
WARN_ON(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
|
||||
hci_uart_tx_wakeup(hu);
|
||||
}
|
||||
|
||||
/** hci_uart_receive_buf - receive buffer wakeup
|
||||
* @serdev: serial device
|
||||
* @data: pointer to received data
|
||||
* @count: count of received data in bytes
|
||||
*
|
||||
* This function is called by the serdev framework when it received data
|
||||
* in the RX buffer.
|
||||
*
|
||||
* Return: number of processed bytes
|
||||
*/
|
||||
static int hci_uart_receive_buf(struct serdev_device *serdev, const u8 *data,
|
||||
size_t count)
|
||||
{
|
||||
struct hci_uart *hu = serdev_device_get_drvdata(serdev);
|
||||
|
||||
if (!hu || serdev != hu->serdev) {
|
||||
WARN_ON(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!test_bit(HCI_UART_PROTO_READY, &hu->flags))
|
||||
return 0;
|
||||
|
||||
/* It does not need a lock here as it is already protected by a mutex in
|
||||
* tty caller
|
||||
*/
|
||||
hu->proto->recv(hu, data, count);
|
||||
|
||||
if (hu->hdev)
|
||||
hu->hdev->stat.byte_rx += count;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct serdev_device_ops hci_serdev_client_ops = {
|
||||
.receive_buf = hci_uart_receive_buf,
|
||||
.write_wakeup = hci_uart_write_wakeup,
|
||||
};
|
||||
|
||||
int hci_uart_register_device(struct hci_uart *hu,
|
||||
const struct hci_uart_proto *p)
|
||||
{
|
||||
int err;
|
||||
struct hci_dev *hdev;
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
serdev_device_set_client_ops(hu->serdev, &hci_serdev_client_ops);
|
||||
|
||||
err = p->open(hu);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
hu->proto = p;
|
||||
set_bit(HCI_UART_PROTO_READY, &hu->flags);
|
||||
|
||||
/* Initialize and register HCI device */
|
||||
hdev = hci_alloc_dev();
|
||||
if (!hdev) {
|
||||
BT_ERR("Can't allocate HCI device");
|
||||
err = -ENOMEM;
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
hu->hdev = hdev;
|
||||
|
||||
hdev->bus = HCI_UART;
|
||||
hci_set_drvdata(hdev, hu);
|
||||
|
||||
INIT_WORK(&hu->write_work, hci_uart_write_work);
|
||||
|
||||
/* Only when vendor specific setup callback is provided, consider
|
||||
* the manufacturer information valid. This avoids filling in the
|
||||
* value for Ericsson when nothing is specified.
|
||||
*/
|
||||
if (hu->proto->setup)
|
||||
hdev->manufacturer = hu->proto->manufacturer;
|
||||
|
||||
hdev->open = hci_uart_open;
|
||||
hdev->close = hci_uart_close;
|
||||
hdev->flush = hci_uart_flush;
|
||||
hdev->send = hci_uart_send_frame;
|
||||
hdev->setup = hci_uart_setup;
|
||||
SET_HCIDEV_DEV(hdev, &hu->serdev->dev);
|
||||
|
||||
if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags))
|
||||
set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
|
||||
|
||||
if (test_bit(HCI_UART_EXT_CONFIG, &hu->hdev_flags))
|
||||
set_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks);
|
||||
|
||||
if (!test_bit(HCI_UART_RESET_ON_INIT, &hu->hdev_flags))
|
||||
set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);
|
||||
|
||||
if (test_bit(HCI_UART_CREATE_AMP, &hu->hdev_flags))
|
||||
hdev->dev_type = HCI_AMP;
|
||||
else
|
||||
hdev->dev_type = HCI_PRIMARY;
|
||||
|
||||
if (test_bit(HCI_UART_INIT_PENDING, &hu->hdev_flags))
|
||||
return 0;
|
||||
|
||||
if (hci_register_dev(hdev) < 0) {
|
||||
BT_ERR("Can't register HCI device");
|
||||
err = -ENODEV;
|
||||
goto err_register;
|
||||
}
|
||||
|
||||
set_bit(HCI_UART_REGISTERED, &hu->flags);
|
||||
|
||||
return 0;
|
||||
|
||||
err_register:
|
||||
hci_free_dev(hdev);
|
||||
err_alloc:
|
||||
clear_bit(HCI_UART_PROTO_READY, &hu->flags);
|
||||
p->close(hu);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hci_uart_register_device);
|
||||
|
||||
void hci_uart_unregister_device(struct hci_uart *hu)
|
||||
{
|
||||
struct hci_dev *hdev = hu->hdev;
|
||||
|
||||
hci_unregister_dev(hdev);
|
||||
hci_free_dev(hdev);
|
||||
|
||||
cancel_work_sync(&hu->write_work);
|
||||
|
||||
hu->proto->close(hu);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hci_uart_unregister_device);
|
||||
@@ -147,6 +147,9 @@ void bt_err_ratelimited(const char *fmt, ...);
|
||||
#define bt_dev_dbg(hdev, fmt, ...) \
|
||||
BT_DBG("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
|
||||
|
||||
#define bt_dev_err_ratelimited(hdev, fmt, ...) \
|
||||
BT_ERR_RATELIMITED("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
|
||||
|
||||
/* Connection and socket states */
|
||||
enum {
|
||||
BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
|
||||
|
||||
@@ -573,7 +573,7 @@ static int a2mp_discphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
|
||||
hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK,
|
||||
&mgr->l2cap_conn->hcon->dst);
|
||||
if (!hcon) {
|
||||
BT_ERR("No phys link exist");
|
||||
bt_dev_err(hdev, "no phys link exist");
|
||||
rsp.status = A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS;
|
||||
goto clean;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ int phylink_gen_key(struct hci_conn *conn, u8 *data, u8 *len, u8 *type)
|
||||
|
||||
/* Legacy key */
|
||||
if (conn->key_type < 3) {
|
||||
BT_ERR("Legacy key type %d", conn->key_type);
|
||||
bt_dev_err(hdev, "legacy key type %d", conn->key_type);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ int phylink_gen_key(struct hci_conn *conn, u8 *data, u8 *len, u8 *type)
|
||||
/* Derive Generic AMP Link Key (gamp) */
|
||||
err = hmac_sha256(keybuf, HCI_AMP_LINK_KEY_SIZE, "gamp", 4, gamp_key);
|
||||
if (err) {
|
||||
BT_ERR("Could not derive Generic AMP Key: err %d", err);
|
||||
bt_dev_err(hdev, "could not derive Generic AMP Key: err %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -729,8 +729,8 @@ static void create_le_conn_complete(struct hci_dev *hdev, u8 status, u16 opcode)
|
||||
goto done;
|
||||
}
|
||||
|
||||
BT_ERR("HCI request failed to create LE connection: status 0x%2.2x",
|
||||
status);
|
||||
bt_dev_err(hdev, "request failed to create LE connection: "
|
||||
"status 0x%2.2x", status);
|
||||
|
||||
if (!conn)
|
||||
goto done;
|
||||
|
||||
@@ -267,7 +267,7 @@ static int hci_init1_req(struct hci_request *req, unsigned long opt)
|
||||
amp_init1(req);
|
||||
break;
|
||||
default:
|
||||
BT_ERR("Unknown device type %d", hdev->dev_type);
|
||||
bt_dev_err(hdev, "Unknown device type %d", hdev->dev_type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2114,8 +2114,7 @@ static void hci_error_reset(struct work_struct *work)
|
||||
if (hdev->hw_error)
|
||||
hdev->hw_error(hdev, hdev->hw_error_code);
|
||||
else
|
||||
BT_ERR("%s hardware error 0x%2.2x", hdev->name,
|
||||
hdev->hw_error_code);
|
||||
bt_dev_err(hdev, "hardware error 0x%2.2x", hdev->hw_error_code);
|
||||
|
||||
if (hci_dev_do_close(hdev))
|
||||
return;
|
||||
@@ -2488,9 +2487,9 @@ static void hci_cmd_timeout(struct work_struct *work)
|
||||
struct hci_command_hdr *sent = (void *) hdev->sent_cmd->data;
|
||||
u16 opcode = __le16_to_cpu(sent->opcode);
|
||||
|
||||
BT_ERR("%s command 0x%4.4x tx timeout", hdev->name, opcode);
|
||||
bt_dev_err(hdev, "command 0x%4.4x tx timeout", opcode);
|
||||
} else {
|
||||
BT_ERR("%s command tx timeout", hdev->name);
|
||||
bt_dev_err(hdev, "command tx timeout");
|
||||
}
|
||||
|
||||
atomic_set(&hdev->cmd_cnt, 1);
|
||||
@@ -2822,7 +2821,7 @@ struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev,
|
||||
|
||||
params = kzalloc(sizeof(*params), GFP_KERNEL);
|
||||
if (!params) {
|
||||
BT_ERR("Out of memory");
|
||||
bt_dev_err(hdev, "out of memory");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3358,7 +3357,7 @@ static void hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
|
||||
err = hdev->send(hdev, skb);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s sending frame failed (%d)", hdev->name, err);
|
||||
bt_dev_err(hdev, "sending frame failed (%d)", err);
|
||||
kfree_skb(skb);
|
||||
}
|
||||
}
|
||||
@@ -3373,7 +3372,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen,
|
||||
|
||||
skb = hci_prepare_cmd(hdev, opcode, plen, param);
|
||||
if (!skb) {
|
||||
BT_ERR("%s no memory for command", hdev->name);
|
||||
bt_dev_err(hdev, "no memory for command");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -3458,7 +3457,7 @@ static void hci_queue_acl(struct hci_chan *chan, struct sk_buff_head *queue,
|
||||
hci_add_acl_hdr(skb, chan->handle, flags);
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s unknown dev_type %d", hdev->name, hdev->dev_type);
|
||||
bt_dev_err(hdev, "unknown dev_type %d", hdev->dev_type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3583,7 +3582,7 @@ static struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type,
|
||||
break;
|
||||
default:
|
||||
cnt = 0;
|
||||
BT_ERR("Unknown link type");
|
||||
bt_dev_err(hdev, "unknown link type %d", conn->type);
|
||||
}
|
||||
|
||||
q = cnt / num;
|
||||
@@ -3600,15 +3599,15 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type)
|
||||
struct hci_conn_hash *h = &hdev->conn_hash;
|
||||
struct hci_conn *c;
|
||||
|
||||
BT_ERR("%s link tx timeout", hdev->name);
|
||||
bt_dev_err(hdev, "link tx timeout");
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
/* Kill stalled connections */
|
||||
list_for_each_entry_rcu(c, &h->list, list) {
|
||||
if (c->type == type && c->sent) {
|
||||
BT_ERR("%s killing stalled connection %pMR",
|
||||
hdev->name, &c->dst);
|
||||
bt_dev_err(hdev, "killing stalled connection %pMR",
|
||||
&c->dst);
|
||||
hci_disconnect(c, HCI_ERROR_REMOTE_USER_TERM);
|
||||
}
|
||||
}
|
||||
@@ -3689,7 +3688,7 @@ static struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
|
||||
break;
|
||||
default:
|
||||
cnt = 0;
|
||||
BT_ERR("Unknown link type");
|
||||
bt_dev_err(hdev, "unknown link type %d", chan->conn->type);
|
||||
}
|
||||
|
||||
q = cnt / num;
|
||||
@@ -4031,8 +4030,8 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
l2cap_recv_acldata(conn, skb, flags);
|
||||
return;
|
||||
} else {
|
||||
BT_ERR("%s ACL packet for unknown connection handle %d",
|
||||
hdev->name, handle);
|
||||
bt_dev_err(hdev, "ACL packet for unknown connection handle %d",
|
||||
handle);
|
||||
}
|
||||
|
||||
kfree_skb(skb);
|
||||
@@ -4062,8 +4061,8 @@ static void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
sco_recv_scodata(conn, skb);
|
||||
return;
|
||||
} else {
|
||||
BT_ERR("%s SCO packet for unknown connection handle %d",
|
||||
hdev->name, handle);
|
||||
bt_dev_err(hdev, "SCO packet for unknown connection handle %d",
|
||||
handle);
|
||||
}
|
||||
|
||||
kfree_skb(skb);
|
||||
|
||||
@@ -1188,7 +1188,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
|
||||
break;
|
||||
|
||||
default:
|
||||
BT_ERR("Used reserved LE_Scan_Enable param %d", cp->enable);
|
||||
bt_dev_err(hdev, "use of reserved LE_Scan_Enable param %d",
|
||||
cp->enable);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1485,7 +1486,7 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
|
||||
conn = hci_conn_add(hdev, ACL_LINK, &cp->bdaddr,
|
||||
HCI_ROLE_MASTER);
|
||||
if (!conn)
|
||||
BT_ERR("No memory for new connection");
|
||||
bt_dev_err(hdev, "no memory for new connection");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2269,7 +2270,7 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr,
|
||||
HCI_ROLE_SLAVE);
|
||||
if (!conn) {
|
||||
BT_ERR("No memory for new connection");
|
||||
bt_dev_err(hdev, "no memory for new connection");
|
||||
hci_dev_unlock(hdev);
|
||||
return;
|
||||
}
|
||||
@@ -2431,7 +2432,7 @@ static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
|
||||
if (!hci_conn_ssp_enabled(conn) &&
|
||||
test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) {
|
||||
BT_INFO("re-auth of legacy device is not possible.");
|
||||
bt_dev_info(hdev, "re-auth of legacy device is not possible.");
|
||||
} else {
|
||||
set_bit(HCI_CONN_AUTH, &conn->flags);
|
||||
conn->sec_level = conn->pending_sec_level;
|
||||
@@ -2535,8 +2536,7 @@ static void read_enc_key_size_complete(struct hci_dev *hdev, u8 status,
|
||||
BT_DBG("%s status 0x%02x", hdev->name, status);
|
||||
|
||||
if (!skb || skb->len < sizeof(*rp)) {
|
||||
BT_ERR("%s invalid HCI Read Encryption Key Size response",
|
||||
hdev->name);
|
||||
bt_dev_err(hdev, "invalid read key size response");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2554,8 +2554,8 @@ static void read_enc_key_size_complete(struct hci_dev *hdev, u8 status,
|
||||
* supported.
|
||||
*/
|
||||
if (rp->status) {
|
||||
BT_ERR("%s failed to read key size for handle %u", hdev->name,
|
||||
handle);
|
||||
bt_dev_err(hdev, "failed to read key size for handle %u",
|
||||
handle);
|
||||
conn->enc_key_size = HCI_LINK_KEY_SIZE;
|
||||
} else {
|
||||
conn->enc_key_size = rp->key_size;
|
||||
@@ -2664,7 +2664,7 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
hci_req_add(&req, HCI_OP_READ_ENC_KEY_SIZE, sizeof(cp), &cp);
|
||||
|
||||
if (hci_req_run_skb(&req, read_enc_key_size_complete)) {
|
||||
BT_ERR("Sending HCI Read Encryption Key Size failed");
|
||||
bt_dev_err(hdev, "sending read key size failed");
|
||||
conn->enc_key_size = HCI_LINK_KEY_SIZE;
|
||||
goto notify;
|
||||
}
|
||||
@@ -3197,7 +3197,7 @@ static void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
int i;
|
||||
|
||||
if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) {
|
||||
BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode);
|
||||
bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3249,7 +3249,8 @@ static void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
break;
|
||||
|
||||
default:
|
||||
BT_ERR("Unknown type %d conn %p", conn->type, conn);
|
||||
bt_dev_err(hdev, "unknown type %d conn %p",
|
||||
conn->type, conn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3271,7 +3272,7 @@ static struct hci_conn *__hci_conn_lookup_handle(struct hci_dev *hdev,
|
||||
return chan->conn;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s unknown dev_type %d", hdev->name, hdev->dev_type);
|
||||
bt_dev_err(hdev, "unknown dev_type %d", hdev->dev_type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3284,7 +3285,7 @@ static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
int i;
|
||||
|
||||
if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_BLOCK_BASED) {
|
||||
BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode);
|
||||
bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3320,7 +3321,8 @@ static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
break;
|
||||
|
||||
default:
|
||||
BT_ERR("Unknown type %d conn %p", conn->type, conn);
|
||||
bt_dev_err(hdev, "unknown type %d conn %p",
|
||||
conn->type, conn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4479,7 +4481,7 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
if (!conn) {
|
||||
conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr, ev->role);
|
||||
if (!conn) {
|
||||
BT_ERR("No memory for new connection");
|
||||
bt_dev_err(hdev, "no memory for new connection");
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
@@ -4771,8 +4773,7 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
|
||||
|
||||
/* Adjust for actual length */
|
||||
if (len != real_len) {
|
||||
BT_ERR_RATELIMITED("%s advertising data length corrected",
|
||||
hdev->name);
|
||||
bt_dev_err_ratelimited(hdev, "advertising data len corrected");
|
||||
len = real_len;
|
||||
}
|
||||
|
||||
@@ -5199,7 +5200,7 @@ static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode,
|
||||
return false;
|
||||
|
||||
if (skb->len < sizeof(*hdr)) {
|
||||
BT_ERR("Too short HCI event");
|
||||
bt_dev_err(hdev, "too short HCI event");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5213,12 +5214,13 @@ static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode,
|
||||
}
|
||||
|
||||
if (hdr->evt != HCI_EV_CMD_COMPLETE) {
|
||||
BT_DBG("Last event is not cmd complete (0x%2.2x)", hdr->evt);
|
||||
bt_dev_err(hdev, "last event is not cmd complete (0x%2.2x)",
|
||||
hdr->evt);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (skb->len < sizeof(*ev)) {
|
||||
BT_ERR("Too short cmd_complete event");
|
||||
bt_dev_err(hdev, "too short cmd_complete event");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -329,8 +329,8 @@ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
|
||||
|
||||
skb = hci_prepare_cmd(hdev, opcode, plen, param);
|
||||
if (!skb) {
|
||||
BT_ERR("%s no memory for command (opcode 0x%4.4x)",
|
||||
hdev->name, opcode);
|
||||
bt_dev_err(hdev, "no memory for command (opcode 0x%4.4x)",
|
||||
opcode);
|
||||
req->err = -ENOMEM;
|
||||
return;
|
||||
}
|
||||
@@ -1419,7 +1419,7 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
|
||||
|
||||
err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa);
|
||||
if (err < 0) {
|
||||
BT_ERR("%s failed to generate new RPA", hdev->name);
|
||||
bt_dev_err(hdev, "failed to generate new RPA");
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1781,7 +1781,7 @@ int hci_abort_conn(struct hci_conn *conn, u8 reason)
|
||||
|
||||
err = hci_req_run(&req, abort_conn_complete);
|
||||
if (err && err != -ENODATA) {
|
||||
BT_ERR("Failed to run HCI request: err %d", err);
|
||||
bt_dev_err(conn->hdev, "failed to run HCI request: err %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1865,7 +1865,8 @@ static void le_scan_disable_work(struct work_struct *work)
|
||||
|
||||
hci_req_sync(hdev, le_scan_disable, 0, HCI_CMD_TIMEOUT, &status);
|
||||
if (status) {
|
||||
BT_ERR("Failed to disable LE scan: status 0x%02x", status);
|
||||
bt_dev_err(hdev, "failed to disable LE scan: status 0x%02x",
|
||||
status);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1896,7 +1897,7 @@ static void le_scan_disable_work(struct work_struct *work)
|
||||
hci_req_sync(hdev, bredr_inquiry, DISCOV_INTERLEAVED_INQUIRY_LEN,
|
||||
HCI_CMD_TIMEOUT, &status);
|
||||
if (status) {
|
||||
BT_ERR("Inquiry failed: status 0x%02x", status);
|
||||
bt_dev_err(hdev, "inquiry failed: status 0x%02x", status);
|
||||
goto discov_stopped;
|
||||
}
|
||||
|
||||
@@ -1938,7 +1939,8 @@ static void le_scan_restart_work(struct work_struct *work)
|
||||
|
||||
hci_req_sync(hdev, le_scan_restart, 0, HCI_CMD_TIMEOUT, &status);
|
||||
if (status) {
|
||||
BT_ERR("Failed to restart LE scan: status %d", status);
|
||||
bt_dev_err(hdev, "failed to restart LE scan: status %d",
|
||||
status);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
|
||||
dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
|
||||
|
||||
if (device_add(&conn->dev) < 0) {
|
||||
BT_ERR("Failed to register connection device");
|
||||
bt_dev_err(hdev, "failed to register connection device");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2159,8 +2159,8 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
|
||||
key_count = __le16_to_cpu(cp->key_count);
|
||||
if (key_count > max_key_count) {
|
||||
BT_ERR("load_link_keys: too big key_count value %u",
|
||||
key_count);
|
||||
bt_dev_err(hdev, "load_link_keys: too big key_count value %u",
|
||||
key_count);
|
||||
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
@@ -2168,8 +2168,8 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
expected_len = sizeof(*cp) + key_count *
|
||||
sizeof(struct mgmt_link_key_info);
|
||||
if (expected_len != len) {
|
||||
BT_ERR("load_link_keys: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
bt_dev_err(hdev, "load_link_keys: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
@@ -2561,7 +2561,7 @@ static int pin_code_reply(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
|
||||
memcpy(&ncp.addr, &cp->addr, sizeof(ncp.addr));
|
||||
|
||||
BT_ERR("PIN code is not 16 bytes long");
|
||||
bt_dev_err(hdev, "PIN code is not 16 bytes long");
|
||||
|
||||
err = send_pin_code_neg_reply(sk, hdev, &ncp);
|
||||
if (err >= 0)
|
||||
@@ -3391,7 +3391,8 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
|
||||
MGMT_OP_ADD_REMOTE_OOB_DATA,
|
||||
status, &cp->addr, sizeof(cp->addr));
|
||||
} else {
|
||||
BT_ERR("add_remote_oob_data: invalid length of %u bytes", len);
|
||||
bt_dev_err(hdev, "add_remote_oob_data: invalid len of %u bytes",
|
||||
len);
|
||||
err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
@@ -3604,8 +3605,8 @@ static int start_service_discovery(struct sock *sk, struct hci_dev *hdev,
|
||||
|
||||
uuid_count = __le16_to_cpu(cp->uuid_count);
|
||||
if (uuid_count > max_uuid_count) {
|
||||
BT_ERR("service_discovery: too big uuid_count value %u",
|
||||
uuid_count);
|
||||
bt_dev_err(hdev, "service_discovery: too big uuid_count value %u",
|
||||
uuid_count);
|
||||
err = mgmt_cmd_complete(sk, hdev->id,
|
||||
MGMT_OP_START_SERVICE_DISCOVERY,
|
||||
MGMT_STATUS_INVALID_PARAMS, &cp->type,
|
||||
@@ -3615,8 +3616,8 @@ static int start_service_discovery(struct sock *sk, struct hci_dev *hdev,
|
||||
|
||||
expected_len = sizeof(*cp) + uuid_count * 16;
|
||||
if (expected_len != len) {
|
||||
BT_ERR("service_discovery: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
bt_dev_err(hdev, "service_discovery: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
err = mgmt_cmd_complete(sk, hdev->id,
|
||||
MGMT_OP_START_SERVICE_DISCOVERY,
|
||||
MGMT_STATUS_INVALID_PARAMS, &cp->type,
|
||||
@@ -3943,7 +3944,7 @@ static void set_advertising_complete(struct hci_dev *hdev, u8 status,
|
||||
err = hci_req_run(&req, enable_advertising_instance);
|
||||
|
||||
if (err)
|
||||
BT_ERR("Failed to re-configure advertising");
|
||||
bt_dev_err(hdev, "failed to re-configure advertising");
|
||||
|
||||
unlock:
|
||||
hci_dev_unlock(hdev);
|
||||
@@ -4664,15 +4665,16 @@ static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data,
|
||||
|
||||
irk_count = __le16_to_cpu(cp->irk_count);
|
||||
if (irk_count > max_irk_count) {
|
||||
BT_ERR("load_irks: too big irk_count value %u", irk_count);
|
||||
bt_dev_err(hdev, "load_irks: too big irk_count value %u",
|
||||
irk_count);
|
||||
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
|
||||
expected_len = sizeof(*cp) + irk_count * sizeof(struct mgmt_irk_info);
|
||||
if (expected_len != len) {
|
||||
BT_ERR("load_irks: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
bt_dev_err(hdev, "load_irks: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
@@ -4745,7 +4747,8 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
|
||||
|
||||
key_count = __le16_to_cpu(cp->key_count);
|
||||
if (key_count > max_key_count) {
|
||||
BT_ERR("load_ltks: too big key_count value %u", key_count);
|
||||
bt_dev_err(hdev, "load_ltks: too big key_count value %u",
|
||||
key_count);
|
||||
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
@@ -4753,8 +4756,8 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
|
||||
expected_len = sizeof(*cp) + key_count *
|
||||
sizeof(struct mgmt_ltk_info);
|
||||
if (expected_len != len) {
|
||||
BT_ERR("load_keys: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
bt_dev_err(hdev, "load_keys: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
@@ -4873,14 +4876,15 @@ static void conn_info_refresh_complete(struct hci_dev *hdev, u8 hci_status,
|
||||
}
|
||||
|
||||
if (!cp) {
|
||||
BT_ERR("invalid sent_cmd in conn_info response");
|
||||
bt_dev_err(hdev, "invalid sent_cmd in conn_info response");
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
handle = __le16_to_cpu(cp->handle);
|
||||
conn = hci_conn_hash_lookup_handle(hdev, handle);
|
||||
if (!conn) {
|
||||
BT_ERR("unknown handle (%d) in conn_info response", handle);
|
||||
bt_dev_err(hdev, "unknown handle (%d) in conn_info response",
|
||||
handle);
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
@@ -5477,8 +5481,8 @@ static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
|
||||
param_count = __le16_to_cpu(cp->param_count);
|
||||
if (param_count > max_param_count) {
|
||||
BT_ERR("load_conn_param: too big param_count value %u",
|
||||
param_count);
|
||||
bt_dev_err(hdev, "load_conn_param: too big param_count value %u",
|
||||
param_count);
|
||||
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
@@ -5486,8 +5490,8 @@ static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
expected_len = sizeof(*cp) + param_count *
|
||||
sizeof(struct mgmt_conn_param);
|
||||
if (expected_len != len) {
|
||||
BT_ERR("load_conn_param: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
bt_dev_err(hdev, "load_conn_param: expected %u bytes, got %u bytes",
|
||||
expected_len, len);
|
||||
return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM,
|
||||
MGMT_STATUS_INVALID_PARAMS);
|
||||
}
|
||||
@@ -5512,7 +5516,7 @@ static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
} else if (param->addr.type == BDADDR_LE_RANDOM) {
|
||||
addr_type = ADDR_LE_DEV_RANDOM;
|
||||
} else {
|
||||
BT_ERR("Ignoring invalid connection parameters");
|
||||
bt_dev_err(hdev, "ignoring invalid connection parameters");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -5525,14 +5529,14 @@ static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data,
|
||||
min, max, latency, timeout);
|
||||
|
||||
if (hci_check_conn_params(min, max, latency, timeout) < 0) {
|
||||
BT_ERR("Ignoring invalid connection parameters");
|
||||
bt_dev_err(hdev, "ignoring invalid connection parameters");
|
||||
continue;
|
||||
}
|
||||
|
||||
hci_param = hci_conn_params_add(hdev, ¶m->addr.bdaddr,
|
||||
addr_type);
|
||||
if (!hci_param) {
|
||||
BT_ERR("Failed to add connection parameters");
|
||||
bt_dev_err(hdev, "failed to add connection parameters");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -975,7 +975,8 @@ static u8 smp_random(struct smp_chan *smp)
|
||||
return SMP_UNSPECIFIED;
|
||||
|
||||
if (crypto_memneq(smp->pcnf, confirm, sizeof(smp->pcnf))) {
|
||||
BT_ERR("Pairing failed (confirmation values mismatch)");
|
||||
bt_dev_err(hcon->hdev, "pairing failed "
|
||||
"(confirmation values mismatch)");
|
||||
return SMP_CONFIRM_FAILED;
|
||||
}
|
||||
|
||||
@@ -1181,7 +1182,7 @@ static void sc_generate_ltk(struct smp_chan *smp)
|
||||
|
||||
key = hci_find_link_key(hdev, &hcon->dst);
|
||||
if (!key) {
|
||||
BT_ERR("%s No Link Key found to generate LTK", hdev->name);
|
||||
bt_dev_err(hdev, "no Link Key found to generate LTK");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2005,11 +2006,11 @@ static int fixup_sc_false_positive(struct smp_chan *smp)
|
||||
return SMP_UNSPECIFIED;
|
||||
|
||||
if (hci_dev_test_flag(hdev, HCI_SC_ONLY)) {
|
||||
BT_ERR("Refusing SMP SC -> legacy fallback in SC-only mode");
|
||||
bt_dev_err(hdev, "refusing legacy fallback in SC-only mode");
|
||||
return SMP_UNSPECIFIED;
|
||||
}
|
||||
|
||||
BT_ERR("Trying to fall back to legacy SMP");
|
||||
bt_dev_err(hdev, "trying to fall back to legacy SMP");
|
||||
|
||||
req = (void *) &smp->preq[1];
|
||||
rsp = (void *) &smp->prsp[1];
|
||||
@@ -2020,7 +2021,7 @@ static int fixup_sc_false_positive(struct smp_chan *smp)
|
||||
auth = req->auth_req & AUTH_REQ_MASK(hdev);
|
||||
|
||||
if (tk_request(conn, 0, auth, rsp->io_capability, req->io_capability)) {
|
||||
BT_ERR("Failed to fall back to legacy SMP");
|
||||
bt_dev_err(hdev, "failed to fall back to legacy SMP");
|
||||
return SMP_UNSPECIFIED;
|
||||
}
|
||||
|
||||
@@ -2299,7 +2300,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
|
||||
|
||||
chan = conn->smp;
|
||||
if (!chan) {
|
||||
BT_ERR("SMP security requested but not available");
|
||||
bt_dev_err(hcon->hdev, "security requested but not available");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2489,7 +2490,7 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn,
|
||||
*/
|
||||
if (!bacmp(&info->bdaddr, BDADDR_ANY) ||
|
||||
!hci_is_identity_address(&info->bdaddr, info->addr_type)) {
|
||||
BT_ERR("Ignoring IRK with no identity address");
|
||||
bt_dev_err(hcon->hdev, "ignoring IRK with no identity address");
|
||||
goto distribute;
|
||||
}
|
||||
|
||||
@@ -2882,8 +2883,8 @@ done:
|
||||
return err;
|
||||
|
||||
drop:
|
||||
BT_ERR("%s unexpected SMP command 0x%02x from %pMR", hcon->hdev->name,
|
||||
code, &hcon->dst);
|
||||
bt_dev_err(hcon->hdev, "unexpected SMP command 0x%02x from %pMR",
|
||||
code, &hcon->dst);
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
@@ -2950,8 +2951,7 @@ static void bredr_pairing(struct l2cap_chan *chan)
|
||||
|
||||
smp = smp_chan_create(conn);
|
||||
if (!smp) {
|
||||
BT_ERR("%s unable to create SMP context for BR/EDR",
|
||||
hdev->name);
|
||||
bt_dev_err(hdev, "unable to create SMP context for BR/EDR");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user