Loading drivers/usb/gadget/function/f_mtp.c +20 −11 Original line number Diff line number Diff line Loading @@ -477,7 +477,7 @@ static void mtp_complete_in(struct usb_ep *ep, struct usb_request *req) { struct mtp_dev *dev = _mtp_dev; if (req->status != 0) if (req->status != 0 && dev->state != STATE_OFFLINE) dev->state = STATE_ERROR; mtp_req_put(dev, &dev->tx_idle, req); Loading @@ -490,7 +490,7 @@ static void mtp_complete_out(struct usb_ep *ep, struct usb_request *req) struct mtp_dev *dev = _mtp_dev; dev->rx_done = 1; if (req->status != 0) if (req->status != 0 && dev->state != STATE_OFFLINE) dev->state = STATE_ERROR; wake_up(&dev->read_wq); Loading @@ -500,7 +500,7 @@ static void mtp_complete_intr(struct usb_ep *ep, struct usb_request *req) { struct mtp_dev *dev = _mtp_dev; if (req->status != 0) if (req->status != 0 && dev->state != STATE_OFFLINE) dev->state = STATE_ERROR; mtp_req_put(dev, &dev->intr_idle, req); Loading Loading @@ -619,7 +619,7 @@ static ssize_t mtp_read(struct file *fp, char __user *buf, int len; int ret = 0; DBG(cdev, "mtp_read(%zu)\n", count); DBG(cdev, "mtp_read(%zu) state:%d\n", count, dev->state); /* we will block until we're online */ DBG(cdev, "mtp_read: waiting for online state\n"); Loading Loading @@ -695,7 +695,7 @@ done: dev->state = STATE_READY; spin_unlock_irq(&dev->lock); DBG(cdev, "mtp_read returning %zd\n", r); DBG(cdev, "mtp_read returning %zd state:%d\n", r, dev->state); return r; } Loading @@ -710,7 +710,7 @@ static ssize_t mtp_write(struct file *fp, const char __user *buf, int sendZLP = 0; int ret; DBG(cdev, "mtp_write(%zu)\n", count); DBG(cdev, "mtp_write(%zu) state:%d\n", count, dev->state); spin_lock_irq(&dev->lock); if (dev->state == STATE_CANCELED) { Loading Loading @@ -749,6 +749,8 @@ static ssize_t mtp_write(struct file *fp, const char __user *buf, ((req = mtp_req_get(dev, &dev->tx_idle)) || dev->state != STATE_BUSY)); if (!req) { DBG(cdev, "mtp_write request NULL ret:%d state:%d\n", ret, dev->state); r = ret; break; } Loading Loading @@ -787,7 +789,7 @@ static ssize_t mtp_write(struct file *fp, const char __user *buf, dev->state = STATE_READY; spin_unlock_irq(&dev->lock); DBG(cdev, "mtp_write returning %zd\n", r); DBG(cdev, "mtp_write returning %zd state:%d\n", r, dev->state); return r; } Loading Loading @@ -843,6 +845,9 @@ static void send_file_work(struct work_struct *data) break; } if (!req) { DBG(cdev, "send_file_work request NULL ret:%d state:%d\n", ret, dev->state); r = ret; break; } Loading Loading @@ -895,7 +900,7 @@ static void send_file_work(struct work_struct *data) if (req) mtp_req_put(dev, &dev->tx_idle, req); DBG(cdev, "send_file_work returning %d\n", r); DBG(cdev, "send_file_work returning %d state:%d\n", r, dev->state); /* write the result */ dev->xfer_result = r; smp_wmb(); Loading Loading @@ -1047,8 +1052,10 @@ static long mtp_send_receive_ioctl(struct file *fp, unsigned code, struct work_struct *work; int ret = -EINVAL; if (mtp_lock(&dev->ioctl_excl)) if (mtp_lock(&dev->ioctl_excl)) { DBG(dev->cdev, "ioctl returning EBUSY state:%d\n", dev->state); return -EBUSY; } spin_lock_irq(&dev->lock); if (dev->state == STATE_CANCELED) { Loading Loading @@ -1113,7 +1120,7 @@ fail: spin_unlock_irq(&dev->lock); out: mtp_unlock(&dev->ioctl_excl); DBG(dev->cdev, "ioctl returning %d\n", ret); DBG(dev->cdev, "ioctl returning %d state:%d\n", ret, dev->state); return ret; } Loading Loading @@ -1226,8 +1233,10 @@ fail: static int mtp_open(struct inode *ip, struct file *fp) { printk(KERN_INFO "mtp_open\n"); if (mtp_lock(&_mtp_dev->open_excl)) if (mtp_lock(&_mtp_dev->open_excl)) { pr_err("%s mtp_release not called returning EBUSY\n", __func__); return -EBUSY; } /* clear any error condition */ if (_mtp_dev->state != STATE_OFFLINE) Loading Loading
drivers/usb/gadget/function/f_mtp.c +20 −11 Original line number Diff line number Diff line Loading @@ -477,7 +477,7 @@ static void mtp_complete_in(struct usb_ep *ep, struct usb_request *req) { struct mtp_dev *dev = _mtp_dev; if (req->status != 0) if (req->status != 0 && dev->state != STATE_OFFLINE) dev->state = STATE_ERROR; mtp_req_put(dev, &dev->tx_idle, req); Loading @@ -490,7 +490,7 @@ static void mtp_complete_out(struct usb_ep *ep, struct usb_request *req) struct mtp_dev *dev = _mtp_dev; dev->rx_done = 1; if (req->status != 0) if (req->status != 0 && dev->state != STATE_OFFLINE) dev->state = STATE_ERROR; wake_up(&dev->read_wq); Loading @@ -500,7 +500,7 @@ static void mtp_complete_intr(struct usb_ep *ep, struct usb_request *req) { struct mtp_dev *dev = _mtp_dev; if (req->status != 0) if (req->status != 0 && dev->state != STATE_OFFLINE) dev->state = STATE_ERROR; mtp_req_put(dev, &dev->intr_idle, req); Loading Loading @@ -619,7 +619,7 @@ static ssize_t mtp_read(struct file *fp, char __user *buf, int len; int ret = 0; DBG(cdev, "mtp_read(%zu)\n", count); DBG(cdev, "mtp_read(%zu) state:%d\n", count, dev->state); /* we will block until we're online */ DBG(cdev, "mtp_read: waiting for online state\n"); Loading Loading @@ -695,7 +695,7 @@ done: dev->state = STATE_READY; spin_unlock_irq(&dev->lock); DBG(cdev, "mtp_read returning %zd\n", r); DBG(cdev, "mtp_read returning %zd state:%d\n", r, dev->state); return r; } Loading @@ -710,7 +710,7 @@ static ssize_t mtp_write(struct file *fp, const char __user *buf, int sendZLP = 0; int ret; DBG(cdev, "mtp_write(%zu)\n", count); DBG(cdev, "mtp_write(%zu) state:%d\n", count, dev->state); spin_lock_irq(&dev->lock); if (dev->state == STATE_CANCELED) { Loading Loading @@ -749,6 +749,8 @@ static ssize_t mtp_write(struct file *fp, const char __user *buf, ((req = mtp_req_get(dev, &dev->tx_idle)) || dev->state != STATE_BUSY)); if (!req) { DBG(cdev, "mtp_write request NULL ret:%d state:%d\n", ret, dev->state); r = ret; break; } Loading Loading @@ -787,7 +789,7 @@ static ssize_t mtp_write(struct file *fp, const char __user *buf, dev->state = STATE_READY; spin_unlock_irq(&dev->lock); DBG(cdev, "mtp_write returning %zd\n", r); DBG(cdev, "mtp_write returning %zd state:%d\n", r, dev->state); return r; } Loading Loading @@ -843,6 +845,9 @@ static void send_file_work(struct work_struct *data) break; } if (!req) { DBG(cdev, "send_file_work request NULL ret:%d state:%d\n", ret, dev->state); r = ret; break; } Loading Loading @@ -895,7 +900,7 @@ static void send_file_work(struct work_struct *data) if (req) mtp_req_put(dev, &dev->tx_idle, req); DBG(cdev, "send_file_work returning %d\n", r); DBG(cdev, "send_file_work returning %d state:%d\n", r, dev->state); /* write the result */ dev->xfer_result = r; smp_wmb(); Loading Loading @@ -1047,8 +1052,10 @@ static long mtp_send_receive_ioctl(struct file *fp, unsigned code, struct work_struct *work; int ret = -EINVAL; if (mtp_lock(&dev->ioctl_excl)) if (mtp_lock(&dev->ioctl_excl)) { DBG(dev->cdev, "ioctl returning EBUSY state:%d\n", dev->state); return -EBUSY; } spin_lock_irq(&dev->lock); if (dev->state == STATE_CANCELED) { Loading Loading @@ -1113,7 +1120,7 @@ fail: spin_unlock_irq(&dev->lock); out: mtp_unlock(&dev->ioctl_excl); DBG(dev->cdev, "ioctl returning %d\n", ret); DBG(dev->cdev, "ioctl returning %d state:%d\n", ret, dev->state); return ret; } Loading Loading @@ -1226,8 +1233,10 @@ fail: static int mtp_open(struct inode *ip, struct file *fp) { printk(KERN_INFO "mtp_open\n"); if (mtp_lock(&_mtp_dev->open_excl)) if (mtp_lock(&_mtp_dev->open_excl)) { pr_err("%s mtp_release not called returning EBUSY\n", __func__); return -EBUSY; } /* clear any error condition */ if (_mtp_dev->state != STATE_OFFLINE) Loading