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

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

Merge "usb: msm: bam: Avoid usb_bam_get_connection_idx error"

parents fc3416cd 9f75ffb3
Loading
Loading
Loading
Loading
+2 −22
Original line number Diff line number Diff line
@@ -3563,8 +3563,6 @@ EXPORT_SYMBOL(usb_bam_get_bam_type);

bool msm_bam_device_lpm_ok(enum usb_ctrl bam_type)
{
	pr_debug("%s: enter bam%s\n", __func__, bam_enable_strings[bam_type]);

	/*
	 * There is the possibility of a race between the usb_bam_probe()
	 * function initializing the relevant spinlocks and structures, vs. the
@@ -3578,31 +3576,13 @@ bool msm_bam_device_lpm_ok(enum usb_ctrl bam_type)
		info[bam_type].lpm_wait_pipes) {
		info[bam_type].pending_lpm = 1;
		spin_unlock(&usb_bam_ipa_handshake_info_lock);
		pr_err("%s: Scheduling LPM for later\n", __func__);
		pr_info("%s: Scheduling LPM for later\n", __func__);
		return 0;
	} else {
		int idx = usb_bam_get_qdss_idx(0);
		struct usb_bam_pipe_connect *pipe_connect;

		/*
		 * Disconnecting bam pipes happens in work queue context during
		 * cable disconnect in qdss composition and will access USB bam
		 * registers. There is a chance that USB might have entered low
		 * power mode by the time this work is scheduled and could cause
		 * crash. Hence don't allow low power mode while bam pipes are
		 * still connected.
		 */
		if (idx >= 0) {
			pipe_connect = &usb_bam_connections[idx];
			if (pipe_connect->enabled) {
				spin_unlock(&usb_bam_ipa_handshake_info_lock);
				return 0;
			}
		}
		info[bam_type].pending_lpm = 0;
		info[bam_type].in_lpm = true;
		spin_unlock(&usb_bam_ipa_handshake_info_lock);
		pr_err("%s: Going to LPM now\n", __func__);
		pr_info("%s: Going to LPM now\n", __func__);
		return 1;
	}
}
+6 −2
Original line number Diff line number Diff line
@@ -510,6 +510,7 @@ static void usb_qdss_disconnect_work(struct work_struct *work)
	if (qdss->port_num >= nr_qdss_ports) {
		pr_err("%s: supporting ports#%u port_id:%u", __func__,
				nr_qdss_ports, portno);
		msm_bam_set_qdss_usb_active(false);
		return;
	}
	pr_debug("usb_qdss_disconnect_work\n");
@@ -562,6 +563,7 @@ static void usb_qdss_disconnect_work(struct work_struct *work)
				xport_to_str(dxport));
	}

	msm_bam_set_qdss_usb_active(false);
}

static void qdss_disable(struct usb_function *f)
@@ -600,6 +602,7 @@ static void qdss_disable(struct usb_function *f)
	spin_unlock_irqrestore(&qdss->lock, flags);
	/*cancell all active xfers*/
	qdss_eps_disable(f);
	msm_bam_set_qdss_usb_active(true);
	queue_work(qdss->wq, &qdss->disconnect_w);
}

@@ -833,9 +836,10 @@ static int qdss_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
		}
	}
	if (qdss->usb_connected && (ch->app_conn ||
		(dxport == USB_GADGET_XPORT_HSIC)))
		queue_work(qdss->wq, &qdss->connect_w);
		(dxport == USB_GADGET_XPORT_HSIC))) {
		msm_bam_set_qdss_usb_active(true);
		queue_work(qdss->wq, &qdss->connect_w);
	}
	return 0;
fail:
	pr_err("qdss_set_alt failed\n");