mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
Merge "USB: f_fs: Fix disconnect check during ongoing IO"
This commit is contained in:
commit
e5bd1aef80
1 changed files with 13 additions and 2 deletions
|
|
@ -1183,7 +1183,12 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
|
|||
*/
|
||||
spin_lock_irq(&epfile->ffs->eps_lock);
|
||||
interrupted = true;
|
||||
if (ep->ep) {
|
||||
/*
|
||||
* While we were acquiring lock endpoint got
|
||||
* disabled (disconnect) or changed
|
||||
(composition switch) ?
|
||||
*/
|
||||
if (epfile->ep == ep) {
|
||||
usb_ep_dequeue(ep->ep, req);
|
||||
spin_unlock_irq(&epfile->ffs->eps_lock);
|
||||
wait_for_completion(&done);
|
||||
|
|
@ -1203,7 +1208,12 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
|
|||
|
||||
ret = -ENODEV;
|
||||
spin_lock_irq(&epfile->ffs->eps_lock);
|
||||
if (ep->ep)
|
||||
/*
|
||||
* While we were acquiring lock endpoint got
|
||||
* disabled (disconnect) or changed
|
||||
* (composition switch) ?
|
||||
*/
|
||||
if (epfile->ep == ep)
|
||||
ret = ep->status;
|
||||
spin_unlock_irq(&epfile->ffs->eps_lock);
|
||||
if (io_data->read && ret > 0)
|
||||
|
|
@ -3901,6 +3911,7 @@ static void ffs_func_unbind(struct usb_configuration *c,
|
|||
if (ep->ep && ep->req)
|
||||
usb_ep_free_request(ep->ep, ep->req);
|
||||
ep->req = NULL;
|
||||
ep->ep = NULL;
|
||||
++ep;
|
||||
}
|
||||
spin_unlock_irqrestore(&func->ffs->eps_lock, flags);
|
||||
|
|
|
|||
Loading…
Reference in a new issue