From: Luiz Augusto von Dentz Date: Tue, 2 May 2023 22:11:59 +0000 (-0700) Subject: Bluetooth: btusb: Don't suspend when there are connections X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4e0a1d8b06751d9ea8357e1f29f6b31465856665;p=linux.git Bluetooth: btusb: Don't suspend when there are connections This checks if there are connections before suspending since that may disrupt the connections making it stop receiving any data if remote wakeup is not enabled. Signed-off-by: Luiz Augusto von Dentz --- diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index b8e9de887b5de..0926e4451802e 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -4629,6 +4629,10 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) BT_DBG("intf %p", intf); + /* Don't suspend if there are connections */ + if (hci_conn_count(data->hdev)) + return -EBUSY; + if (data->suspend_count++) return 0;