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

Commit 3b795995 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: gadget: f_fs: Fix adb issues due to retrying adb_read"

parents 33dbc776 6b4ed96e
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -711,6 +711,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
{
	struct ffs_epfile *epfile = file->private_data;
	struct ffs_ep *ep;
	struct ffs_data *ffs = epfile->ffs;
	char *data = NULL;
	ssize_t ret, data_len = -EINVAL;
	int halt;
@@ -721,7 +722,6 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
			io_data->read);

retry:
	first_read = false;
	if (atomic_read(&epfile->error))
		return -ENODEV;

@@ -949,15 +949,25 @@ retry:
					ret = ep->status;
				else
					ret = -ENODEV;

				/* do wait again if func eps are not enabled */
				if (io_data->read && first_read && (ret < 0)) {
					unsigned short count = ffs->eps_count;
					pr_debug("%s: waiting for the online state\n",
						 __func__);
					ret = 0;
					kfree(data);
					data = NULL;
					data_len = -EINVAL;
					spin_unlock_irq(&epfile->ffs->eps_lock);
					mutex_unlock(&epfile->mutex);
					epfile = ffs->epfiles;
					do {
						atomic_set(&epfile->error, 0);
						++epfile;
					} while (--count);
					epfile = file->private_data;
					first_read = false;
					goto retry;
				}