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

Commit 988a1d2a authored by Bar Weiner's avatar Bar Weiner
Browse files

usb: gadget: Start write_tobam work only from USB bus resume



This fix solves an issue where start_rx() and write_tobam()
create a recursive infinite loop causing a 100% CPU utilization.
The proposed solution is to queue write_tobam() work only when
start_rx is called as part of the resume sequence.

Change-Id: I4ff664bd6e8afc66fa5dec169df443b624c86995
Signed-off-by: default avatarBar Weiner <bweiner@codeaurora.org>
parent 71ee1119
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -697,9 +697,6 @@ static void gbam_start_rx(struct gbam_port *port)
		}
	}

	/* If this function was called from resume, send pending skbs to BAM */
	queue_work(gbam_wq, &d->write_tobam_w);

	spin_unlock_irqrestore(&port->port_lock_ul, flags);
}

@@ -831,8 +828,10 @@ static void gbam_start(void *param, enum usb_bam_pipe_dir dir)
	if (dir == USB_TO_PEER_PERIPHERAL) {
		if (port->data_ch.src_pipe_type == USB_BAM_PIPE_BAM2BAM)
			gbam_start_endless_rx(port);
		else
		else {
			gbam_start_rx(port);
			queue_work(gbam_wq, &d->write_tobam_w);
		}
	} else {
		if (gadget_is_dwc3(gadget) &&
		    msm_dwc3_reset_ep_after_lpm(gadget)) {
+3 −4
Original line number Diff line number Diff line
@@ -324,9 +324,6 @@ static void bam_data_start_rx(struct bam_data_port *port)
		}
	}

	/* If this function was called from resume, send pending skbs to BAM */
	queue_work(bam_data_wq, &d->write_tobam_w);

	spin_unlock_irqrestore(&port->port_lock_ul, flags);
}

@@ -1319,8 +1316,10 @@ static void bam_data_start(void *param, enum usb_bam_pipe_dir dir)
	if (dir == USB_TO_PEER_PERIPHERAL) {
		if (port->data_ch.src_pipe_type == USB_BAM_PIPE_BAM2BAM)
			bam_data_start_endless_rx(port);
		else
		else {
			bam_data_start_rx(port);
			queue_work(bam_data_wq, &d->write_tobam_w);
		}
	} else {
		if (gadget_is_dwc3(gadget) &&
		    msm_dwc3_reset_ep_after_lpm(gadget)) {