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

Commit d96a89de authored by Vincent.Chen's avatar Vincent.Chen Committed by hecaiqiang
Browse files

Add qmi patch_2



Change-Id: Iedd9175be591a3f7229a098368b7e0a0dd052d14
Signed-off-by: default avatarVincent.Chen <vincent.chen@oneplus.com>
Signed-off-by: default avatarGopi Sai Teja <gopi.teja@oneplus.com>
(cherry picked from commit fe792965e669dc3f90fee7ded6175a601361a27a)
parent ddf5e61f
Loading
Loading
Loading
Loading
+15 −22
Original line number Diff line number Diff line
@@ -317,7 +317,6 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn,

	memset(txn, 0, sizeof(*txn));

	mutex_init(&txn->lock);
	init_completion(&txn->completion);
	txn->qmi = qmi;
	txn->ei = ei;
@@ -357,9 +356,7 @@ int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout)
		return txn->result;

	mutex_lock(&qmi->txn_lock);
	mutex_lock(&txn->lock);
	idr_remove(&qmi->txns, txn->id);
	mutex_unlock(&txn->lock);
	mutex_unlock(&qmi->txn_lock);

	if (ret == 0)
@@ -378,9 +375,7 @@ void qmi_txn_cancel(struct qmi_txn *txn)
	struct qmi_handle *qmi = txn->qmi;

	mutex_lock(&qmi->txn_lock);
	mutex_lock(&txn->lock);
	idr_remove(&qmi->txns, txn->id);
	mutex_unlock(&txn->lock);
	mutex_unlock(&qmi->txn_lock);
}
EXPORT_SYMBOL(qmi_txn_cancel);
@@ -501,24 +496,22 @@ static void qmi_handle_message(struct qmi_handle *qmi,
	if (hdr->type == QMI_RESPONSE) {
		mutex_lock(&qmi->txn_lock);
		txn = idr_find(&qmi->txns, hdr->txn_id);
		if (txn)
			mutex_lock(&txn->lock);
		/* Ignore unexpected responses */
		if (!txn) {
			mutex_unlock(&qmi->txn_lock);
			return;
		}

	if (txn && txn->dest && txn->ei) {
		if (txn->dest && txn->ei) {
			ret = qmi_decode_message(buf, len, txn->ei, txn->dest);
			if (ret < 0)
				pr_err("failed to decode incoming message\n");

			txn->result = ret;
			complete(&txn->completion);

		mutex_unlock(&txn->lock);
	} else if (txn) {
		} else {
			qmi_invoke_handler(qmi, sq, txn, buf, len);

		mutex_unlock(&txn->lock);
		}
		mutex_unlock(&qmi->txn_lock);
	} else {
		/* Create a txn based on the txn_id of the incoming message */
		memset(&tmp_txn, 0, sizeof(tmp_txn));
+0 −2
Original line number Diff line number Diff line
@@ -166,7 +166,6 @@ struct qmi_ops {
 * struct qmi_txn - transaction context
 * @qmi:	QMI handle this transaction is associated with
 * @id:		transaction id
 * @lock:	for synchronization between handler and waiter of messages
 * @completion:	completion object as the transaction receives a response
 * @result:	result code for the completed transaction
 * @ei:		description of the QMI encoded response (optional)
@@ -177,7 +176,6 @@ struct qmi_txn {

	u16 id;

	struct mutex lock;
	struct completion completion;
	int result;