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

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

Merge "USB: f_fs: Don't queue already queued request again"

parents 32a91b52 814277d9
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ struct ffs_ep {
	u8				num;

	int				status;	/* P: epfile->mutex */
	bool				is_busy;
};

struct ffs_epfile {
@@ -633,6 +634,8 @@ static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req)
	if (likely(req->context)) {
		struct ffs_ep *ep = _ep->driver_data;
		ep->status = req->status ? req->status : req->actual;
		/* Set is_busy false to indicate completion of last request */
		ep->is_busy = false;
		complete(req->context);
	}
}
@@ -848,8 +851,13 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)

			req->context  = &done;
			req->complete = ffs_epfile_io_complete;
			ret	      = 0;

			/* Don't queue another read if previous is still busy */
			if (!(io_data->read && ep->is_busy)) {
				ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
				ep->is_busy = true;
			}

			spin_unlock_irq(&epfile->ffs->eps_lock);