diff options
author | Oliver Neukum <oliver@neukum.org> | 2010-02-27 20:56:22 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-19 07:24:16 -0700 |
commit | 62e6685470fb04fb7688ecef96c39160498721d5 (patch) | |
tree | 2350c3c979dad7cbc73a7edbc22e9bfef188a867 /drivers/usb/class | |
parent | beb1d35f1690fe27694472a010a8e4a9ae11cc50 (diff) | |
download | kernel_samsung_crespo-62e6685470fb04fb7688ecef96c39160498721d5.zip kernel_samsung_crespo-62e6685470fb04fb7688ecef96c39160498721d5.tar.gz kernel_samsung_crespo-62e6685470fb04fb7688ecef96c39160498721d5.tar.bz2 |
usb: cdc-wdm:Fix loss of data due to autosuspend
The guarding flag must be set and tested under spinlock
and cleared before the URBs are resubmitted in resume.
Signed-off-by: Oliver Neukum <neukum@b1-systems.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/class')
-rw-r--r-- | drivers/usb/class/cdc-wdm.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index a6b5e9f..07c1297 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -794,14 +794,17 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message) dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); 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); kill_urbs(desc); #ifdef CONFIG_PM @@ -831,8 +834,8 @@ static int wdm_resume(struct usb_interface *intf) dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); mutex_lock(&desc->lock); - rv = recover_from_urb_loss(desc); clear_bit(WDM_SUSPENDING, &desc->flags); + rv = recover_from_urb_loss(desc); mutex_unlock(&desc->lock); return rv; } |