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

Commit b447e287 authored by Udipto Goswami's avatar Udipto Goswami
Browse files

USB: f_mtp: Revert Avoid queuing of receive_file_work for 0 length



Commit 76f7005a ("USB: f_mtp: Avoid queuing of receive_file_work
for 0 length") adds a check for 0 length file and avoid queuing in
order to save some milliseconds in mtp file transfers.
However, this approach is correct only for windows system as it
ignores 0 length files but other OS like MAC & Ubuntu do not follow
this logic. They allows 0 length file to be copied which is why mtp
file transfer failure is observed when target is connected to MAC
or Ubuntu.

Fix this by reverting the check for 0 length.

Change-Id: I48559e89afa7a4220bdef3f078e2aa739c402b4b
Signed-off-by: default avatarUdipto Goswami <ugoswami@codeaurora.org>
parent 757f1d14
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -1128,17 +1128,14 @@ static long mtp_send_receive_ioctl(struct file *fp, unsigned int code,
	 * in kernel context, which is necessary for vfs_read and
	 * vfs_write to use our buffers in the kernel address space.
	 */
	dev->xfer_result = 0;
	if (dev->xfer_file_length) {
	queue_work(dev->wq, work);
	/* wait for operation to complete */
	flush_workqueue(dev->wq);
	fput(filp);

	/* read the result */
	smp_rmb();
	}
	ret = dev->xfer_result;
	fput(filp);

fail:
	spin_lock_irq(&dev->lock);