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

Commit 8ff64fbe authored by Jack Pham's avatar Jack Pham Committed by Matt Wagantall
Browse files

usb: gadget: qti: Don't call rmnet_disconnect from ctrl_disconnect



Though the name is confusing, the g_rmnet->disconnect() callback
should only be called in cases where the RmNet function needs to
indicate control disconnect to the host, such as when the modem
goes offline. This is because frmnet_disconnect() issues a CDC
NETWORK_CONNECTION notification message on the interrupt endpoint
to indicate the control interface has gone down. However, this
should not be called from the gqti_ctrl_disconnect() function,
which is only called when the USB bus is suspended or when the
cable is disconnected--in these cases, it is invalid to try to
to queue an interrupt packet since it will always fail.

Change-Id: Idca9a9385d7be78601227d9ef56318cb03c80c19
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 2eb6129c
Loading
Loading
Loading
Loading
+7 −15
Original line number Diff line number Diff line
@@ -264,17 +264,6 @@ void gqti_ctrl_disconnect(void *gr, u8 port_num)
		return;
	}

	if (gr && (port->gtype == USB_GADGET_RMNET)) {
		g_rmnet = (struct grmnet *)gr;
		g_rmnet->disconnect(g_rmnet);
	} else if (gr && (port->gtype == USB_GADGET_DPL)) {
		g_dpl = (struct gqdss *)gr;
	} else {
		pr_err("%s(): unrecognized gadget type(%d).\n",
					__func__, port->gtype);
		return;
	}

	atomic_set(&port->connected, 0);
	atomic_set(&port->line_state, 0);
	spin_lock_irqsave(&port->lock, flags);
@@ -284,14 +273,17 @@ void gqti_ctrl_disconnect(void *gr, u8 port_num)
	port->ipa_cons_idx = -1;
	port->port_usb = NULL;

	if (g_rmnet) {
	if (gr && port->gtype == USB_GADGET_RMNET) {
		g_rmnet = (struct grmnet *)gr;
		g_rmnet->send_encap_cmd = NULL;
		g_rmnet->notify_modem = NULL;
	}

	if (g_dpl) {
	} else if (gr && port->gtype == USB_GADGET_DPL) {
		g_dpl = (struct gqdss *)gr;
		g_dpl->send_encap_cmd = NULL;
		g_dpl->notify_modem = NULL;
	} else {
		pr_err("%s(): unrecognized gadget type(%d).\n",
					__func__, port->gtype);
	}

	while (!list_empty(&port->cpkt_req_q)) {