Commit bbf0cb3e authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: cdc-acm: simplify runtime PM locking

We can simply the runtime PM locking as there's no need to check the
susp_count in the read path (at least not since killing the rx tasklet).

Specifically, the read urbs will never be resubmitted by the completion
handler when killed during suspend.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5292afa6
...@@ -428,7 +428,7 @@ static void acm_read_bulk_callback(struct urb *urb) ...@@ -428,7 +428,7 @@ static void acm_read_bulk_callback(struct urb *urb)
/* throttle device if requested by tty */ /* throttle device if requested by tty */
spin_lock_irqsave(&acm->read_lock, flags); spin_lock_irqsave(&acm->read_lock, flags);
acm->throttled = acm->throttle_req; acm->throttled = acm->throttle_req;
if (!acm->throttled && !acm->susp_count) { if (!acm->throttled) {
spin_unlock_irqrestore(&acm->read_lock, flags); spin_unlock_irqrestore(&acm->read_lock, flags);
acm_submit_read_urb(acm, rb->index, GFP_ATOMIC); acm_submit_read_urb(acm, rb->index, GFP_ATOMIC);
} else { } else {
...@@ -1546,18 +1546,15 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -1546,18 +1546,15 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message)
struct acm *acm = usb_get_intfdata(intf); struct acm *acm = usb_get_intfdata(intf);
int cnt; int cnt;
spin_lock_irq(&acm->read_lock); spin_lock_irq(&acm->write_lock);
spin_lock(&acm->write_lock);
if (PMSG_IS_AUTO(message)) { if (PMSG_IS_AUTO(message)) {
if (acm->transmitting) { if (acm->transmitting) {
spin_unlock(&acm->write_lock); spin_unlock_irq(&acm->write_lock);
spin_unlock_irq(&acm->read_lock);
return -EBUSY; return -EBUSY;
} }
} }
cnt = acm->susp_count++; cnt = acm->susp_count++;
spin_unlock(&acm->write_lock); spin_unlock_irq(&acm->write_lock);
spin_unlock_irq(&acm->read_lock);
if (cnt) if (cnt)
return 0; return 0;
...@@ -1573,8 +1570,7 @@ static int acm_resume(struct usb_interface *intf) ...@@ -1573,8 +1570,7 @@ static int acm_resume(struct usb_interface *intf)
struct urb *urb; struct urb *urb;
int rv = 0; int rv = 0;
spin_lock_irq(&acm->read_lock); spin_lock_irq(&acm->write_lock);
spin_lock(&acm->write_lock);
if (--acm->susp_count) if (--acm->susp_count)
goto out; goto out;
...@@ -1600,8 +1596,7 @@ static int acm_resume(struct usb_interface *intf) ...@@ -1600,8 +1596,7 @@ static int acm_resume(struct usb_interface *intf)
rv = acm_submit_read_urbs(acm, GFP_ATOMIC); rv = acm_submit_read_urbs(acm, GFP_ATOMIC);
} }
out: out:
spin_unlock(&acm->write_lock); spin_unlock_irq(&acm->write_lock);
spin_unlock_irq(&acm->read_lock);
return rv; return rv;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment