static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
{
struct btusb_data *data = usb_get_intfdata(intf);
- int err;
BT_DBG("intf %p", intf);
if (data->suspend_count++)
return 0;
- /* Notify Host stack to suspend; this has to be done before stopping
- * the traffic since the hci_suspend_dev itself may generate some
- * traffic.
- */
- err = hci_suspend_dev(data->hdev);
- if (err) {
- data->suspend_count--;
- return err;
- }
-
spin_lock_irq(&data->txlock);
if (!(PMSG_IS_AUTO(message) && data->tx_in_flight)) {
set_bit(BTUSB_SUSPENDING, &data->flags);
} else {
spin_unlock_irq(&data->txlock);
data->suspend_count--;
- hci_resume_dev(data->hdev);
return -EBUSY;
}
spin_unlock_irq(&data->txlock);
schedule_work(&data->work);
- hci_resume_dev(data->hdev);
-
return 0;
failed: