Commit 301927d2 authored by Jakub Kicinski's avatar Jakub Kicinski

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/20240726150502.3300832-1-luiz.dentz@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 69794365 df3d6a3e
......@@ -413,6 +413,7 @@ config BT_ATH3K
config BT_MTKSDIO
tristate "MediaTek HCI SDIO driver"
depends on MMC
depends on USB || !BT_HCIBTUSB_MTK
select BT_MTK
help
MediaTek Bluetooth HCI SDIO driver.
......@@ -425,6 +426,7 @@ config BT_MTKSDIO
config BT_MTKUART
tristate "MediaTek HCI UART driver"
depends on SERIAL_DEV_BUS
depends on USB || !BT_HCIBTUSB_MTK
select BT_MTK
help
MediaTek Bluetooth HCI UART driver.
......
......@@ -3085,6 +3085,9 @@ static int btintel_setup_combined(struct hci_dev *hdev)
btintel_set_dsm_reset_method(hdev, &ver_tlv);
err = btintel_bootloader_setup_tlv(hdev, &ver_tlv);
if (err)
goto exit_error;
btintel_register_devcoredump_support(hdev);
btintel_print_fseq_info(hdev);
break;
......
......@@ -437,6 +437,7 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb)
}
EXPORT_SYMBOL_GPL(btmtk_process_coredump);
#if IS_ENABLED(CONFIG_BT_HCIBTUSB_MTK)
static void btmtk_usb_wmt_recv(struct urb *urb)
{
struct hci_dev *hdev = urb->context;
......@@ -1262,7 +1263,8 @@ int btmtk_usb_suspend(struct hci_dev *hdev)
struct btmtk_data *btmtk_data = hci_get_priv(hdev);
/* Stop urb anchor for iso data transmission */
usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
return 0;
}
......@@ -1487,6 +1489,7 @@ int btmtk_usb_shutdown(struct hci_dev *hdev)
return 0;
}
EXPORT_SYMBOL_GPL(btmtk_usb_shutdown);
#endif
MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
MODULE_AUTHOR("Mark Chen <mark-yw.chen@mediatek.com>");
......
......@@ -119,13 +119,6 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
case DISCOVERY_STARTING:
break;
case DISCOVERY_FINDING:
/* If discovery was not started then it was initiated by the
* MGMT interface so no MGMT event shall be generated either
*/
if (old_state != DISCOVERY_STARTING) {
hdev->discovery.state = old_state;
return;
}
mgmt_discovering(hdev, 1);
break;
case DISCOVERY_RESOLVING:
......
......@@ -1721,9 +1721,10 @@ static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable)
switch (enable) {
case LE_SCAN_ENABLE:
hci_dev_set_flag(hdev, HCI_LE_SCAN);
if (hdev->le_scan_type == LE_SCAN_ACTIVE)
if (hdev->le_scan_type == LE_SCAN_ACTIVE) {
clear_pending_adv_report(hdev);
hci_discovery_set_state(hdev, DISCOVERY_FINDING);
hci_discovery_set_state(hdev, DISCOVERY_FINDING);
}
break;
case LE_SCAN_DISABLE:
......
......@@ -2976,6 +2976,27 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
*/
filter_policy = hci_update_accept_list_sync(hdev);
/* If suspended and filter_policy set to 0x00 (no acceptlist) then
* passive scanning cannot be started since that would require the host
* to be woken up to process the reports.
*/
if (hdev->suspended && !filter_policy) {
/* Check if accept list is empty then there is no need to scan
* while suspended.
*/
if (list_empty(&hdev->le_accept_list))
return 0;
/* If there are devices is the accept_list that means some
* devices could not be programmed which in non-suspended case
* means filter_policy needs to be set to 0x00 so the host needs
* to filter, but since this is treating suspended case we
* can ignore device needing host to filter to allow devices in
* the acceptlist to be able to wakeup the system.
*/
filter_policy = 0x01;
}
/* When the controller is using random resolvable addresses and
* with that having LE privacy enabled, then controllers with
* Extended Scanner Filter Policies support can now enable support
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment