Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1389b135 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: mtp: Improve throughput during multiple file transfer"

parents 81ab6ff7 5278a9fe
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -125,7 +125,6 @@ struct mtp_dev {

	wait_queue_head_t read_wq;
	wait_queue_head_t write_wq;
	wait_queue_head_t intr_wq;
	struct usb_request *rx_req[RX_REQ_MAX];
	int rx_done;

@@ -500,8 +499,6 @@ static void mtp_complete_intr(struct usb_ep *ep, struct usb_request *req)
		dev->state = STATE_ERROR;

	mtp_req_put(dev, &dev->intr_idle, req);

	wake_up(&dev->intr_wq);
}

static int mtp_create_bulk_endpoints(struct mtp_dev *dev,
@@ -1064,18 +1061,16 @@ static int mtp_send_event(struct mtp_dev *dev, struct mtp_event *event)
	int ret;
	int length = event->length;

	mtp_log("(%zu)\n", event->length);
	mtp_log("enter: (%zu)\n", event->length);

	if (length < 0 || length > INTR_BUFFER_SIZE)
		return -EINVAL;
	if (dev->state == STATE_OFFLINE)
		return -ENODEV;

	ret = wait_event_interruptible_timeout(dev->intr_wq,
			(req = mtp_req_get(dev, &dev->intr_idle)),
			msecs_to_jiffies(1000));
	req = mtp_req_get(dev, &dev->intr_idle);
	if (!req)
		return -ETIME;
		return -EBUSY;

	if (copy_from_user(req->buf, (void __user *)event->data, length)) {
		mtp_req_put(dev, &dev->intr_idle, req);
@@ -1086,6 +1081,7 @@ static int mtp_send_event(struct mtp_dev *dev, struct mtp_event *event)
	if (ret)
		mtp_req_put(dev, &dev->intr_idle, req);

	mtp_log("exit: (%d)\n", ret);
	return ret;
}

@@ -1097,6 +1093,7 @@ static long mtp_send_receive_ioctl(struct file *fp, unsigned int code,
	struct work_struct *work;
	int ret = -EINVAL;

	mtp_log("entering ioctl with state: %d\n", dev->state);
	if (mtp_lock(&dev->ioctl_excl)) {
		mtp_log("ioctl returning EBUSY state:%d\n", dev->state);
		return -EBUSY;
@@ -1710,7 +1707,6 @@ static int __mtp_setup(struct mtp_instance *fi_mtp)
	spin_lock_init(&dev->lock);
	init_waitqueue_head(&dev->read_wq);
	init_waitqueue_head(&dev->write_wq);
	init_waitqueue_head(&dev->intr_wq);
	atomic_set(&dev->open_excl, 0);
	atomic_set(&dev->ioctl_excl, 0);
	INIT_LIST_HEAD(&dev->tx_idle);