Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188776
b: refs/heads/master
c: d93d16e
h: refs/heads/master
v: v3
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Mar 19, 2010
1 parent 874434d commit d4255b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 62e6685470fb04fb7688ecef96c39160498721d5
refs/heads/master: d93d16e9aa58887feadd999ea26b7b8139e98b56
25 changes: 17 additions & 8 deletions trunk/drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,44 +776,48 @@ static void wdm_disconnect(struct usb_interface *intf)
/* to terminate pending flushes */
clear_bit(WDM_IN_USE, &desc->flags);
spin_unlock_irqrestore(&desc->iuspin, flags);
cancel_work_sync(&desc->rxwork);
mutex_lock(&desc->lock);
kill_urbs(desc);
cancel_work_sync(&desc->rxwork);
mutex_unlock(&desc->lock);
wake_up_all(&desc->wait);
if (!desc->count)
cleanup(desc);
mutex_unlock(&wdm_mutex);
}

#ifdef CONFIG_PM
static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
{
struct wdm_device *desc = usb_get_intfdata(intf);
int rv = 0;

dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);

mutex_lock(&desc->lock);
/* if this is an autosuspend the caller does the locking */
if (!(message.event & PM_EVENT_AUTO))
mutex_lock(&desc->lock);
spin_lock_irq(&desc->iuspin);
#ifdef CONFIG_PM

if ((message.event & PM_EVENT_AUTO) &&
(test_bit(WDM_IN_USE, &desc->flags)
|| test_bit(WDM_RESPONDING, &desc->flags))) {
spin_unlock_irq(&desc->iuspin);
rv = -EBUSY;
} else {
#endif

set_bit(WDM_SUSPENDING, &desc->flags);
spin_unlock_irq(&desc->iuspin);
cancel_work_sync(&desc->rxwork);
/* callback submits work - order is essential */
kill_urbs(desc);
#ifdef CONFIG_PM
cancel_work_sync(&desc->rxwork);
}
#endif
mutex_unlock(&desc->lock);
if (!(message.event & PM_EVENT_AUTO))
mutex_unlock(&desc->lock);

return rv;
}
#endif

static int recover_from_urb_loss(struct wdm_device *desc)
{
Expand All @@ -827,6 +831,8 @@ static int recover_from_urb_loss(struct wdm_device *desc)
}
return rv;
}

#ifdef CONFIG_PM
static int wdm_resume(struct usb_interface *intf)
{
struct wdm_device *desc = usb_get_intfdata(intf);
Expand All @@ -839,6 +845,7 @@ static int wdm_resume(struct usb_interface *intf)
mutex_unlock(&desc->lock);
return rv;
}
#endif

static int wdm_pre_reset(struct usb_interface *intf)
{
Expand All @@ -862,9 +869,11 @@ static struct usb_driver wdm_driver = {
.name = "cdc_wdm",
.probe = wdm_probe,
.disconnect = wdm_disconnect,
#ifdef CONFIG_PM
.suspend = wdm_suspend,
.resume = wdm_resume,
.reset_resume = wdm_resume,
#endif
.pre_reset = wdm_pre_reset,
.post_reset = wdm_post_reset,
.id_table = wdm_ids,
Expand Down

0 comments on commit d4255b0

Please sign in to comment.