Skip to content

Commit 301927d

Browse files
committed
Merge tag 'for-net-2024-07-26' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
Luiz Augusto von Dentz says: ==================== bluetooth pull request for net: - btmtk: Fix kernel crash when entering btmtk_usb_suspend - btmtk: Fix btmtk.c undefined reference build error - btintel: Fail setup on error - hci_sync: Fix suspending with wrong filter policy - hci_event: Fix setting DISCOVERY_FINDING for passive scanning * tag 'for-net-2024-07-26' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth: Bluetooth: hci_event: Fix setting DISCOVERY_FINDING for passive scanning Bluetooth: btmtk: remove #ifdef around declarations Bluetooth: btmtk: Fix btmtk.c undefined reference build error harder Bluetooth: btmtk: Fix btmtk.c undefined reference build error Bluetooth: hci_sync: Fix suspending with wrong filter policy Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend Bluetooth: btintel: Fail setup on error ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 6979436 + df3d6a3 commit 301927d

File tree

6 files changed

+33
-10
lines changed

6 files changed

+33
-10
lines changed

drivers/bluetooth/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ config BT_ATH3K
413413
config BT_MTKSDIO
414414
tristate "MediaTek HCI SDIO driver"
415415
depends on MMC
416+
depends on USB || !BT_HCIBTUSB_MTK
416417
select BT_MTK
417418
help
418419
MediaTek Bluetooth HCI SDIO driver.
@@ -425,6 +426,7 @@ config BT_MTKSDIO
425426
config BT_MTKUART
426427
tristate "MediaTek HCI UART driver"
427428
depends on SERIAL_DEV_BUS
429+
depends on USB || !BT_HCIBTUSB_MTK
428430
select BT_MTK
429431
help
430432
MediaTek Bluetooth HCI UART driver.

drivers/bluetooth/btintel.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3085,6 +3085,9 @@ static int btintel_setup_combined(struct hci_dev *hdev)
30853085
btintel_set_dsm_reset_method(hdev, &ver_tlv);
30863086

30873087
err = btintel_bootloader_setup_tlv(hdev, &ver_tlv);
3088+
if (err)
3089+
goto exit_error;
3090+
30883091
btintel_register_devcoredump_support(hdev);
30893092
btintel_print_fseq_info(hdev);
30903093
break;

drivers/bluetooth/btmtk.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb)
437437
}
438438
EXPORT_SYMBOL_GPL(btmtk_process_coredump);
439439

440+
#if IS_ENABLED(CONFIG_BT_HCIBTUSB_MTK)
440441
static void btmtk_usb_wmt_recv(struct urb *urb)
441442
{
442443
struct hci_dev *hdev = urb->context;
@@ -1262,7 +1263,8 @@ int btmtk_usb_suspend(struct hci_dev *hdev)
12621263
struct btmtk_data *btmtk_data = hci_get_priv(hdev);
12631264

12641265
/* Stop urb anchor for iso data transmission */
1265-
usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
1266+
if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
1267+
usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
12661268

12671269
return 0;
12681270
}
@@ -1487,6 +1489,7 @@ int btmtk_usb_shutdown(struct hci_dev *hdev)
14871489
return 0;
14881490
}
14891491
EXPORT_SYMBOL_GPL(btmtk_usb_shutdown);
1492+
#endif
14901493

14911494
MODULE_AUTHOR("Sean Wang <[email protected]>");
14921495
MODULE_AUTHOR("Mark Chen <[email protected]>");

net/bluetooth/hci_core.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,6 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
119119
case DISCOVERY_STARTING:
120120
break;
121121
case DISCOVERY_FINDING:
122-
/* If discovery was not started then it was initiated by the
123-
* MGMT interface so no MGMT event shall be generated either
124-
*/
125-
if (old_state != DISCOVERY_STARTING) {
126-
hdev->discovery.state = old_state;
127-
return;
128-
}
129122
mgmt_discovering(hdev, 1);
130123
break;
131124
case DISCOVERY_RESOLVING:

net/bluetooth/hci_event.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,9 +1721,10 @@ static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable)
17211721
switch (enable) {
17221722
case LE_SCAN_ENABLE:
17231723
hci_dev_set_flag(hdev, HCI_LE_SCAN);
1724-
if (hdev->le_scan_type == LE_SCAN_ACTIVE)
1724+
if (hdev->le_scan_type == LE_SCAN_ACTIVE) {
17251725
clear_pending_adv_report(hdev);
1726-
hci_discovery_set_state(hdev, DISCOVERY_FINDING);
1726+
hci_discovery_set_state(hdev, DISCOVERY_FINDING);
1727+
}
17271728
break;
17281729

17291730
case LE_SCAN_DISABLE:

net/bluetooth/hci_sync.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,6 +2976,27 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
29762976
*/
29772977
filter_policy = hci_update_accept_list_sync(hdev);
29782978

2979+
/* If suspended and filter_policy set to 0x00 (no acceptlist) then
2980+
* passive scanning cannot be started since that would require the host
2981+
* to be woken up to process the reports.
2982+
*/
2983+
if (hdev->suspended && !filter_policy) {
2984+
/* Check if accept list is empty then there is no need to scan
2985+
* while suspended.
2986+
*/
2987+
if (list_empty(&hdev->le_accept_list))
2988+
return 0;
2989+
2990+
/* If there are devices is the accept_list that means some
2991+
* devices could not be programmed which in non-suspended case
2992+
* means filter_policy needs to be set to 0x00 so the host needs
2993+
* to filter, but since this is treating suspended case we
2994+
* can ignore device needing host to filter to allow devices in
2995+
* the acceptlist to be able to wakeup the system.
2996+
*/
2997+
filter_policy = 0x01;
2998+
}
2999+
29793000
/* When the controller is using random resolvable addresses and
29803001
* with that having LE privacy enabled, then controllers with
29813002
* Extended Scanner Filter Policies support can now enable support

0 commit comments

Comments
 (0)