cdc-wdm.c (94bd217e2d683719ab21a4ac117d8a1b91cbedc9) cdc-wdm.c (5b1b0b812a7b1a5b968c5d06d90d1cb88621b941)
1/*
2 * cdc-wdm.c
3 *
4 * This driver supports USB CDC WCM Device Management.
5 *
6 * Copyright (c) 2007-2009 Oliver Neukum
7 *
8 * Some code taken from cdc-acm.c

--- 784 unchanged lines hidden (view full) ---

793static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
794{
795 struct wdm_device *desc = usb_get_intfdata(intf);
796 int rv = 0;
797
798 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);
799
800 /* if this is an autosuspend the caller does the locking */
1/*
2 * cdc-wdm.c
3 *
4 * This driver supports USB CDC WCM Device Management.
5 *
6 * Copyright (c) 2007-2009 Oliver Neukum
7 *
8 * Some code taken from cdc-acm.c

--- 784 unchanged lines hidden (view full) ---

793static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
794{
795 struct wdm_device *desc = usb_get_intfdata(intf);
796 int rv = 0;
797
798 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);
799
800 /* if this is an autosuspend the caller does the locking */
801 if (!(message.event & PM_EVENT_AUTO))
801 if (!PMSG_IS_AUTO(message))
802 mutex_lock(&desc->lock);
803 spin_lock_irq(&desc->iuspin);
804
802 mutex_lock(&desc->lock);
803 spin_lock_irq(&desc->iuspin);
804
805 if ((message.event & PM_EVENT_AUTO) &&
805 if (PMSG_IS_AUTO(message) &&
806 (test_bit(WDM_IN_USE, &desc->flags)
807 || test_bit(WDM_RESPONDING, &desc->flags))) {
808 spin_unlock_irq(&desc->iuspin);
809 rv = -EBUSY;
810 } else {
811
812 set_bit(WDM_SUSPENDING, &desc->flags);
813 spin_unlock_irq(&desc->iuspin);
814 /* callback submits work - order is essential */
815 kill_urbs(desc);
816 cancel_work_sync(&desc->rxwork);
817 }
806 (test_bit(WDM_IN_USE, &desc->flags)
807 || test_bit(WDM_RESPONDING, &desc->flags))) {
808 spin_unlock_irq(&desc->iuspin);
809 rv = -EBUSY;
810 } else {
811
812 set_bit(WDM_SUSPENDING, &desc->flags);
813 spin_unlock_irq(&desc->iuspin);
814 /* callback submits work - order is essential */
815 kill_urbs(desc);
816 cancel_work_sync(&desc->rxwork);
817 }
818 if (!(message.event & PM_EVENT_AUTO))
818 if (!PMSG_IS_AUTO(message))
819 mutex_unlock(&desc->lock);
820
821 return rv;
822}
823#endif
824
825static int recover_from_urb_loss(struct wdm_device *desc)
826{

--- 93 unchanged lines hidden ---
819 mutex_unlock(&desc->lock);
820
821 return rv;
822}
823#endif
824
825static int recover_from_urb_loss(struct wdm_device *desc)
826{

--- 93 unchanged lines hidden ---