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

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

Merge "Revert "usb: gadget: Perform usb_ep_disable in workqueue""

parents cff39011 7389e94f
Loading
Loading
Loading
Loading
+31 −43
Original line number Diff line number Diff line
@@ -591,46 +591,6 @@ static int bam_data_peer_reset_cb(void *param)
	return 0;
}

static void disable_data_ep(struct bam_data_port *port)
{
	struct bam_data_ch_info *d = &port->data_ch;

	if (!port->port_usb)
		return;

	if (d->trans == USB_GADGET_XPORT_BAM2BAM_IPA) {
		port->port_usb->ipa_consumer_ep = -1;
		port->port_usb->ipa_producer_ep = -1;
	}

	if (port->port_usb->in && port->port_usb->in->driver_data) {
		/* disable endpoints */
		usb_ep_disable(port->port_usb->out);
		usb_ep_disable(port->port_usb->in);

		/*
		 * Set endless flag to false as USB Endpoint
		 * is already disable.
		 */
		if (d->trans == USB_GADGET_XPORT_BAM2BAM ||
			d->trans == USB_GADGET_XPORT_BAM2BAM_IPA ||
			d->trans == USB_GADGET_XPORT_BAM) {

			if (d->dst_pipe_type == USB_BAM_PIPE_BAM2BAM)
				port->port_usb->in->endless = false;

			if (d->src_pipe_type == USB_BAM_PIPE_BAM2BAM)
				port->port_usb->out->endless = false;
		}

		port->port_usb->in->driver_data = NULL;
		port->port_usb->out->driver_data = NULL;

		port->port_usb = NULL;
	}
}


static void bam2bam_data_disconnect_work(struct work_struct *w)
{
	struct bam_data_port *port =
@@ -644,8 +604,6 @@ static void bam2bam_data_disconnect_work(struct work_struct *w)
		return;
	}

	disable_data_ep(port);

	if (d->trans == USB_GADGET_XPORT_BAM2BAM_IPA) {
		if (d->src_pipe_type == USB_BAM_PIPE_BAM2BAM)
			priv = d->ipa_params.priv;
@@ -1102,11 +1060,41 @@ void bam_data_disconnect(struct data_port *gr, u8 port_num)
	}

	d = &port->data_ch;
	if (port->port_usb) {
		if (d->trans == USB_GADGET_XPORT_BAM2BAM_IPA) {
			port->port_usb->ipa_consumer_ep = -1;
			port->port_usb->ipa_producer_ep = -1;
		}
		if (port->port_usb->in && port->port_usb->in->driver_data) {
			/* disable endpoints */
			usb_ep_disable(port->port_usb->out);
			usb_ep_disable(port->port_usb->in);

			/*
			 * Set endless flag to false as USB Endpoint
			 * is already disable.
			 */
			if (d->trans == USB_GADGET_XPORT_BAM2BAM ||
				d->trans == USB_GADGET_XPORT_BAM2BAM_IPA ||
				d->trans == USB_GADGET_XPORT_BAM) {

				if (d->dst_pipe_type == USB_BAM_PIPE_BAM2BAM)
					port->port_usb->in->endless = false;

				if (d->src_pipe_type == USB_BAM_PIPE_BAM2BAM)
					port->port_usb->out->endless = false;
			}

			port->port_usb->in->driver_data = NULL;
			port->port_usb->out->driver_data = NULL;

			port->port_usb = NULL;
		}
	}

	if (d->trans == USB_GADGET_XPORT_BAM2BAM_IPA) {
		queue_work(bam_data_wq, &port->disconnect_w);
	} else {
		disable_data_ep(port);
		if (usb_bam_client_ready(false))
			pr_err("%s: usb_bam_client_ready failed\n",
				__func__);