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

Commit d90a3136 authored by Tarun Gupta's avatar Tarun Gupta
Browse files

USB: gadget: u_bam_data: Allow connect work to run once during resume



In some scenarios like suspend/resume, connect work is scheduled two
times during resume. This could cause setting ipa handlers to invalid
values and results in disconnect ipa failures. Due to this, subsequent
connect ipa always returns in success with pipes already connected
message and causes ip address not assigning. Hence add proper checks
in connect work so that not to allow connect work to run for a second
time.

CRs-Fixed: 848456
Change-Id: I7cf65878b542ef86c0b00daae9255dc7902a99f9
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: default avatarTarun Gupta <tarung@codeaurora.org>
parent 0597b5d5
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -886,6 +886,18 @@ static void bam2bam_data_connect_work(struct work_struct *w)
		return;
	}

	/*
	 * check if connect_w got called two times during RNDIS resume as
	 * explicit flow control is called to start data transfers after
	 * bam_data_connect()
	 */
	if (port->is_ipa_connected) {
		pr_debug("IPA connect is already done & Transfers started\n");
		spin_unlock_irqrestore(&port->port_lock, flags);
		usb_gadget_autopm_put_async(port->gadget);
		return;
	}

	d->ipa_params.usb_connection_speed = gadget->speed;
	d->ipa_params.cons_clnt_hdl = -1;
	d->ipa_params.prod_clnt_hdl = -1;