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

Commit d44f01f4 authored by Prashanth K's avatar Prashanth K
Browse files

usb: gadget: f_cdev: Call function wakeup if func_wakeup_pending is set



Perform function wakeup from cser_resume if func_wakup_pending
flag is true. Set it again if the func_wakeup returns -EAGAIN.

Change-Id: If056327126e932911e3d832421b6171a50757e55
Signed-off-by: default avatarPrashanth K <quic_prashk@quicinc.com>
parent 5caba725
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -566,8 +566,13 @@ static void usb_cser_resume(struct usb_function *f)
	 * In that case resume is done by Function Resume request (write).
	 */
	if ((cdev->gadget->speed >= USB_SPEED_SUPER) &&
			port->func_is_suspended)
			port->func_is_suspended) {
		if (port->func_wakeup_pending) {
			ret = usb_func_wakeup(f);
			port->func_wakeup_pending = (ret == -EAGAIN) ? true : false;
		}
		return;
	}

	pr_debug("%s\n", __func__);
	port->is_suspended = false;
@@ -1462,9 +1467,10 @@ ssize_t f_cdev_write(struct file *file,
		spin_unlock_irqrestore(&port->port_lock, flags);

		if (gadget->speed >= USB_SPEED_SUPER
		    && port->func_is_suspended)
		    && port->func_is_suspended) {
			ret = usb_func_wakeup(func);
		else
			port->func_wakeup_pending = (ret == -EAGAIN) ? true : false;
		} else
			ret = usb_gadget_wakeup(gadget);

		if (ret < 0 && ret != -EACCES && ret != -EAGAIN) {