Skip to content

Commit 95f9292

Browse files
ChrisCH-LuVudentz
authored andcommitted
Bluetooth: btusb: add callback function in btusb suspend/resume
Add suspend/resum callback function in btusb_data which are reserved for vendor specific usage during suspend/resume. hdev->suspend will be added before stop traffic in btusb_suspend and hdev-> resume will be added after resubmit urb in btusb_resume. Signed-off-by: Chris Lu <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent d3e6236 commit 95f9292

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/bluetooth/btusb.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,9 @@ struct btusb_data {
895895

896896
int (*setup_on_usb)(struct hci_dev *hdev);
897897

898+
int (*suspend)(struct hci_dev *hdev);
899+
int (*resume)(struct hci_dev *hdev);
900+
898901
int oob_wake_irq; /* irq for out-of-band wake-on-bt */
899902
unsigned cmd_timeout_cnt;
900903

@@ -4769,6 +4772,9 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
47694772

47704773
cancel_work_sync(&data->work);
47714774

4775+
if (data->suspend)
4776+
data->suspend(data->hdev);
4777+
47724778
btusb_stop_traffic(data);
47734779
usb_kill_anchored_urbs(&data->tx_anchor);
47744780

@@ -4872,6 +4878,9 @@ static int btusb_resume(struct usb_interface *intf)
48724878
btusb_submit_isoc_urb(hdev, GFP_NOIO);
48734879
}
48744880

4881+
if (data->resume)
4882+
data->resume(hdev);
4883+
48754884
spin_lock_irq(&data->txlock);
48764885
play_deferred(data);
48774886
clear_bit(BTUSB_SUSPENDING, &data->flags);

0 commit comments

Comments
 (0)