Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-net-2025-01-08' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth

Luiz Augusto von Dentz says:

====================
bluetooth pull request for net:

- btmtk: Fix failed to send func ctrl for MediaTek devices.
- hci_sync: Fix not setting Random Address when required
- MGMT: Fix Add Device to responding before completing
- btnxpuart: Fix driver sending truncated data

* tag 'for-net-2025-01-08' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth:
Bluetooth: btmtk: Fix failed to send func ctrl for MediaTek devices.
Bluetooth: btnxpuart: Fix driver sending truncated data
Bluetooth: MGMT: Fix Add Device to responding before completing
Bluetooth: hci_sync: Fix not setting Random Address when required
====================

Link: https://patch.msgid.link/20250108162627.1623760-1-luiz.dentz@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+52 -9
+7
drivers/bluetooth/btmtk.c
··· 1472 1472 1473 1473 int btmtk_usb_shutdown(struct hci_dev *hdev) 1474 1474 { 1475 + struct btmtk_data *data = hci_get_priv(hdev); 1475 1476 struct btmtk_hci_wmt_params wmt_params; 1476 1477 u8 param = 0; 1477 1478 int err; 1479 + 1480 + err = usb_autopm_get_interface(data->intf); 1481 + if (err < 0) 1482 + return err; 1478 1483 1479 1484 /* Disable the device */ 1480 1485 wmt_params.op = BTMTK_WMT_FUNC_CTRL; ··· 1491 1486 err = btmtk_usb_hci_wmt_sync(hdev, &wmt_params); 1492 1487 if (err < 0) { 1493 1488 bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err); 1489 + usb_autopm_put_interface(data->intf); 1494 1490 return err; 1495 1491 } 1496 1492 1493 + usb_autopm_put_interface(data->intf); 1497 1494 return 0; 1498 1495 } 1499 1496 EXPORT_SYMBOL_GPL(btmtk_usb_shutdown);
+1
drivers/bluetooth/btnxpuart.c
··· 1381 1381 1382 1382 while ((skb = nxp_dequeue(nxpdev))) { 1383 1383 len = serdev_device_write_buf(serdev, skb->data, skb->len); 1384 + serdev_device_wait_until_sent(serdev, 0); 1384 1385 hdev->stat.byte_tx += len; 1385 1386 1386 1387 skb_pull(skb, len);
+6 -5
net/bluetooth/hci_sync.c
··· 1031 1031 1032 1032 static int hci_set_random_addr_sync(struct hci_dev *hdev, bdaddr_t *rpa) 1033 1033 { 1034 - /* If we're advertising or initiating an LE connection we can't 1035 - * go ahead and change the random address at this time. This is 1036 - * because the eventual initiator address used for the 1034 + /* If a random_addr has been set we're advertising or initiating an LE 1035 + * connection we can't go ahead and change the random address at this 1036 + * time. This is because the eventual initiator address used for the 1037 1037 * subsequently created connection will be undefined (some 1038 1038 * controllers use the new address and others the one we had 1039 1039 * when the operation started). ··· 1041 1041 * In this kind of scenario skip the update and let the random 1042 1042 * address be updated at the next cycle. 1043 1043 */ 1044 - if (hci_dev_test_flag(hdev, HCI_LE_ADV) || 1045 - hci_lookup_le_connect(hdev)) { 1044 + if (bacmp(&hdev->random_addr, BDADDR_ANY) && 1045 + (hci_dev_test_flag(hdev, HCI_LE_ADV) || 1046 + hci_lookup_le_connect(hdev))) { 1046 1047 bt_dev_dbg(hdev, "Deferring random address update"); 1047 1048 hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); 1048 1049 return 0;
+36 -2
net/bluetooth/mgmt.c
··· 7655 7655 mgmt_event(MGMT_EV_DEVICE_ADDED, hdev, &ev, sizeof(ev), sk); 7656 7656 } 7657 7657 7658 + static void add_device_complete(struct hci_dev *hdev, void *data, int err) 7659 + { 7660 + struct mgmt_pending_cmd *cmd = data; 7661 + struct mgmt_cp_add_device *cp = cmd->param; 7662 + 7663 + if (!err) { 7664 + device_added(cmd->sk, hdev, &cp->addr.bdaddr, cp->addr.type, 7665 + cp->action); 7666 + device_flags_changed(NULL, hdev, &cp->addr.bdaddr, 7667 + cp->addr.type, hdev->conn_flags, 7668 + PTR_UINT(cmd->user_data)); 7669 + } 7670 + 7671 + mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_ADD_DEVICE, 7672 + mgmt_status(err), &cp->addr, sizeof(cp->addr)); 7673 + mgmt_pending_free(cmd); 7674 + } 7675 + 7658 7676 static int add_device_sync(struct hci_dev *hdev, void *data) 7659 7677 { 7660 7678 return hci_update_passive_scan_sync(hdev); ··· 7681 7663 static int add_device(struct sock *sk, struct hci_dev *hdev, 7682 7664 void *data, u16 len) 7683 7665 { 7666 + struct mgmt_pending_cmd *cmd; 7684 7667 struct mgmt_cp_add_device *cp = data; 7685 7668 u8 auto_conn, addr_type; 7686 7669 struct hci_conn_params *params; ··· 7762 7743 current_flags = params->flags; 7763 7744 } 7764 7745 7765 - err = hci_cmd_sync_queue(hdev, add_device_sync, NULL, NULL); 7766 - if (err < 0) 7746 + cmd = mgmt_pending_new(sk, MGMT_OP_ADD_DEVICE, hdev, data, len); 7747 + if (!cmd) { 7748 + err = -ENOMEM; 7767 7749 goto unlock; 7750 + } 7751 + 7752 + cmd->user_data = UINT_PTR(current_flags); 7753 + 7754 + err = hci_cmd_sync_queue(hdev, add_device_sync, cmd, 7755 + add_device_complete); 7756 + if (err < 0) { 7757 + err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_ADD_DEVICE, 7758 + MGMT_STATUS_FAILED, &cp->addr, 7759 + sizeof(cp->addr)); 7760 + mgmt_pending_free(cmd); 7761 + } 7762 + 7763 + goto unlock; 7768 7764 7769 7765 added: 7770 7766 device_added(sk, hdev, &cp->addr.bdaddr, cp->addr.type, cp->action);
+2 -2
net/bluetooth/rfcomm/tty.c
··· 201 201 struct device_attribute *attr, char *buf) 202 202 { 203 203 struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); 204 - return sprintf(buf, "%pMR\n", &dev->dst); 204 + return sysfs_emit(buf, "%pMR\n", &dev->dst); 205 205 } 206 206 207 207 static ssize_t channel_show(struct device *tty_dev, 208 208 struct device_attribute *attr, char *buf) 209 209 { 210 210 struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); 211 - return sprintf(buf, "%d\n", dev->channel); 211 + return sysfs_emit(buf, "%d\n", dev->channel); 212 212 } 213 213 214 214 static DEVICE_ATTR_RO(address);