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

Commit d2bb46f0 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: Fix bug is queuing req upon Function Suspend"

parents 87767c9a 0bd9ae0e
Loading
Loading
Loading
Loading
+12 −7
Original line number Original line Diff line number Diff line
@@ -419,12 +419,14 @@ EXPORT_SYMBOL_GPL(usb_func_wakeup);
int usb_func_ep_queue(struct usb_function *func, struct usb_ep *ep,
int usb_func_ep_queue(struct usb_function *func, struct usb_ep *ep,
			       struct usb_request *req, gfp_t gfp_flags)
			       struct usb_request *req, gfp_t gfp_flags)
{
{
	int ret = -ENOTSUPP;
	int ret;
	struct usb_gadget *gadget;
	struct usb_gadget *gadget;


	if (!func || !func->config || !func->config->cdev ||
	if (!func || !func->config || !func->config->cdev ||
			!func->config->cdev->gadget || !ep || !req)
			!func->config->cdev->gadget || !ep || !req) {
		return -EINVAL;
		ret = -EINVAL;
		goto done;
	}


	pr_debug("Function %s queueing new data into ep %u\n",
	pr_debug("Function %s queueing new data into ep %u\n",
		func->name ? func->name : "", ep->address);
		func->name ? func->name : "", ep->address);
@@ -440,13 +442,16 @@ int usb_func_ep_queue(struct usb_function *func, struct usb_ep *ep,
			pr_err("Failed to wake function %s from suspend state. ret=%d.\n",
			pr_err("Failed to wake function %s from suspend state. ret=%d.\n",
				func->name ? func->name : "", ret);
				func->name ? func->name : "", ret);
		}
		}
		goto done;
	}
	}


	if (!func->func_is_suspended)
	if (func->func_is_suspended && !func->func_wakeup_allowed) {
		ret = 0;
		ret = -ENOTSUPP;
		goto done;
	}


	if (!ret)
	ret = usb_ep_queue(ep, req, gfp_flags);
	ret = usb_ep_queue(ep, req, gfp_flags);
done:
	return ret;
	return ret;
}
}
EXPORT_SYMBOL_GPL(usb_func_ep_queue);
EXPORT_SYMBOL_GPL(usb_func_ep_queue);