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

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

Merge "msm: ipa3: remove redundant and some code duplicate"

parents f456678f dd8fcb77
Loading
Loading
Loading
Loading
+19 −34
Original line number Diff line number Diff line
@@ -787,9 +787,10 @@ int ipa3_usb_init_teth_prot(enum ipa_usb_teth_prot teth_prot,
			result = -EPERM;
			goto bad_params;
		}
		ipa3_usb_ctx->diag_user_data = user_data;
		ipa3_usb_ctx->teth_prot_ctx[teth_prot].user_data = user_data;
		ipa3_usb_ctx->teth_prot_ctx[teth_prot].state =
			IPA_USB_TETH_PROT_INITIALIZED;
		ipa3_usb_ctx->diag_user_data = user_data;
		ipa3_usb_ctx->num_init_prot++;
		IPA_USB_DBG("initialized %s\n",
			ipa3_usb_teth_prot_to_string(teth_prot));
@@ -1661,8 +1662,10 @@ static int ipa3_usb_xdci_disconnect_diag(u32 dl_clnt_hdl)

	/* Disconnect DIAG */
	result = ipa3_usb_disconnect_teth_prot(IPA_USB_DIAG);
	if (result)
	if (result) {
		IPA_USB_ERR("failed to disconnect DIAG tethering protocol\n");
		return result;
	}

	return 0;
}
@@ -1674,29 +1677,13 @@ static int ipa3_usb_check_disconnect_prot(enum ipa_usb_teth_prot teth_prot)
		return -EFAULT;
	}

	switch (teth_prot) {
	case IPA_USB_RNDIS:
	case IPA_USB_ECM:
	case IPA_USB_DIAG:
		if (ipa3_usb_ctx->teth_prot_ctx[teth_prot].state !=
			IPA_USB_TETH_PROT_CONNECTED) {
			IPA_USB_ERR("%s is not connected.\n",
				ipa3_usb_teth_prot_to_string(teth_prot));
			return -EFAULT;
		}
		break;
	case IPA_USB_RMNET:
	case IPA_USB_MBIM:
	if (ipa3_usb_ctx->teth_prot_ctx[teth_prot].state !=
		IPA_USB_TETH_PROT_CONNECTED) {
		IPA_USB_ERR("%s is not connected.\n",
			ipa3_usb_teth_prot_to_string(teth_prot));
		return -EFAULT;
	}
		break;
	default:
		break;
	}

	return 0;
}

@@ -1801,13 +1788,11 @@ int ipa3_usb_xdci_disconnect(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
	if (!ipa3_usb_set_state(IPA_USB_STOPPED))
		IPA_USB_ERR("failed to change state to stopped\n");

	if (teth_prot != IPA_USB_DIAG) {
	result = ipa3_usb_release_xdci_channel(ul_clnt_hdl, teth_prot);
	if (result) {
		IPA_USB_ERR("failed to release UL channel.\n");
		goto bad_params;
	}
	}

	result = ipa3_usb_release_xdci_channel(dl_clnt_hdl, teth_prot);
	if (result) {
@@ -2116,14 +2101,14 @@ int ipa3_usb_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl)

state_change_connected_fail:
	if (prev_state != IPA_USB_SUSPEND_IN_PROGRESS) {
		result = ipa3_stop_gsi_channel(ul_clnt_hdl);
		result = ipa3_stop_gsi_channel(dl_clnt_hdl);
		if (result)
			IPAERR("Error stopping UL channel: %d\n", result);
			IPA_USB_ERR("Error stopping DL channel: %d\n", result);
	}
start_dl_fail:
	result = ipa3_stop_gsi_channel(ul_clnt_hdl);
	if (result)
		IPAERR("Error stopping UL channel: %d\n", result);
		IPA_USB_ERR("Error stopping UL channel: %d\n", result);
start_ul_fail:
	ipa3_usb_release_prod();
prod_req_fail: