Loading drivers/soc/qcom/qmi_interface.c +15 −27 Original line number Original line Diff line number Diff line Loading @@ -317,7 +317,6 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn, memset(txn, 0, sizeof(*txn)); memset(txn, 0, sizeof(*txn)); mutex_init(&txn->lock); init_completion(&txn->completion); init_completion(&txn->completion); txn->qmi = qmi; txn->qmi = qmi; txn->ei = ei; txn->ei = ei; Loading Loading @@ -353,17 +352,12 @@ int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout) ret = wait_for_completion_timeout(&txn->completion, timeout); ret = wait_for_completion_timeout(&txn->completion, timeout); mutex_lock(&txn->lock); if (txn->result == -ENETRESET) { if (txn->result == -ENETRESET) { mutex_unlock(&txn->lock); return txn->result; return txn->result; } } mutex_unlock(&txn->lock); mutex_lock(&qmi->txn_lock); mutex_lock(&qmi->txn_lock); mutex_lock(&txn->lock); idr_remove(&qmi->txns, txn->id); idr_remove(&qmi->txns, txn->id); mutex_unlock(&txn->lock); mutex_unlock(&qmi->txn_lock); mutex_unlock(&qmi->txn_lock); if (ret == 0) if (ret == 0) Loading @@ -382,9 +376,7 @@ void qmi_txn_cancel(struct qmi_txn *txn) struct qmi_handle *qmi = txn->qmi; struct qmi_handle *qmi = txn->qmi; mutex_lock(&qmi->txn_lock); mutex_lock(&qmi->txn_lock); mutex_lock(&txn->lock); idr_remove(&qmi->txns, txn->id); idr_remove(&qmi->txns, txn->id); mutex_unlock(&txn->lock); mutex_unlock(&qmi->txn_lock); mutex_unlock(&qmi->txn_lock); } } EXPORT_SYMBOL(qmi_txn_cancel); EXPORT_SYMBOL(qmi_txn_cancel); Loading Loading @@ -508,24 +500,22 @@ static void qmi_handle_message(struct qmi_handle *qmi, if (hdr->type == QMI_RESPONSE) { if (hdr->type == QMI_RESPONSE) { mutex_lock(&qmi->txn_lock); mutex_lock(&qmi->txn_lock); txn = idr_find(&qmi->txns, hdr->txn_id); txn = idr_find(&qmi->txns, hdr->txn_id); if (txn) /* Ignore unexpected responses */ mutex_lock(&txn->lock); if (!txn) { mutex_unlock(&qmi->txn_lock); mutex_unlock(&qmi->txn_lock); return; } } if (txn->dest && txn->ei) { if (txn && txn->dest && txn->ei) { ret = qmi_decode_message(buf, len, txn->ei, txn->dest); ret = qmi_decode_message(buf, len, txn->ei, txn->dest); if (ret < 0) if (ret < 0) pr_err("failed to decode incoming message\n"); pr_err("failed to decode incoming message\n"); txn->result = ret; txn->result = ret; complete(&txn->completion); complete(&txn->completion); } else { mutex_unlock(&txn->lock); } else if (txn) { qmi_invoke_handler(qmi, sq, txn, buf, len); qmi_invoke_handler(qmi, sq, txn, buf, len); } mutex_unlock(&txn->lock); mutex_unlock(&qmi->txn_lock); } else { } else { /* Create a txn based on the txn_id of the incoming message */ /* Create a txn based on the txn_id of the incoming message */ memset(&tmp_txn, 0, sizeof(tmp_txn)); memset(&tmp_txn, 0, sizeof(tmp_txn)); Loading Loading @@ -736,11 +726,9 @@ void qmi_handle_release(struct qmi_handle *qmi) mutex_lock(&qmi->txn_lock); mutex_lock(&qmi->txn_lock); idr_for_each_entry(&qmi->txns, txn, txn_id) { idr_for_each_entry(&qmi->txns, txn, txn_id) { mutex_lock(&txn->lock); idr_remove(&qmi->txns, txn->id); idr_remove(&qmi->txns, txn->id); txn->result = -ENETRESET; txn->result = -ENETRESET; complete(&txn->completion); complete(&txn->completion); mutex_unlock(&txn->lock); } } mutex_unlock(&qmi->txn_lock); mutex_unlock(&qmi->txn_lock); idr_destroy(&qmi->txns); idr_destroy(&qmi->txns); Loading include/linux/soc/qcom/qmi.h +0 −2 Original line number Original line Diff line number Diff line Loading @@ -166,7 +166,6 @@ struct qmi_ops { * struct qmi_txn - transaction context * struct qmi_txn - transaction context * @qmi: QMI handle this transaction is associated with * @qmi: QMI handle this transaction is associated with * @id: transaction id * @id: transaction id * @lock: for synchronization between handler and waiter of messages * @completion: completion object as the transaction receives a response * @completion: completion object as the transaction receives a response * @result: result code for the completed transaction * @result: result code for the completed transaction * @ei: description of the QMI encoded response (optional) * @ei: description of the QMI encoded response (optional) Loading @@ -177,7 +176,6 @@ struct qmi_txn { u16 id; u16 id; struct mutex lock; struct completion completion; struct completion completion; int result; int result; Loading Loading
drivers/soc/qcom/qmi_interface.c +15 −27 Original line number Original line Diff line number Diff line Loading @@ -317,7 +317,6 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn, memset(txn, 0, sizeof(*txn)); memset(txn, 0, sizeof(*txn)); mutex_init(&txn->lock); init_completion(&txn->completion); init_completion(&txn->completion); txn->qmi = qmi; txn->qmi = qmi; txn->ei = ei; txn->ei = ei; Loading Loading @@ -353,17 +352,12 @@ int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout) ret = wait_for_completion_timeout(&txn->completion, timeout); ret = wait_for_completion_timeout(&txn->completion, timeout); mutex_lock(&txn->lock); if (txn->result == -ENETRESET) { if (txn->result == -ENETRESET) { mutex_unlock(&txn->lock); return txn->result; return txn->result; } } mutex_unlock(&txn->lock); mutex_lock(&qmi->txn_lock); mutex_lock(&qmi->txn_lock); mutex_lock(&txn->lock); idr_remove(&qmi->txns, txn->id); idr_remove(&qmi->txns, txn->id); mutex_unlock(&txn->lock); mutex_unlock(&qmi->txn_lock); mutex_unlock(&qmi->txn_lock); if (ret == 0) if (ret == 0) Loading @@ -382,9 +376,7 @@ void qmi_txn_cancel(struct qmi_txn *txn) struct qmi_handle *qmi = txn->qmi; struct qmi_handle *qmi = txn->qmi; mutex_lock(&qmi->txn_lock); mutex_lock(&qmi->txn_lock); mutex_lock(&txn->lock); idr_remove(&qmi->txns, txn->id); idr_remove(&qmi->txns, txn->id); mutex_unlock(&txn->lock); mutex_unlock(&qmi->txn_lock); mutex_unlock(&qmi->txn_lock); } } EXPORT_SYMBOL(qmi_txn_cancel); EXPORT_SYMBOL(qmi_txn_cancel); Loading Loading @@ -508,24 +500,22 @@ static void qmi_handle_message(struct qmi_handle *qmi, if (hdr->type == QMI_RESPONSE) { if (hdr->type == QMI_RESPONSE) { mutex_lock(&qmi->txn_lock); mutex_lock(&qmi->txn_lock); txn = idr_find(&qmi->txns, hdr->txn_id); txn = idr_find(&qmi->txns, hdr->txn_id); if (txn) /* Ignore unexpected responses */ mutex_lock(&txn->lock); if (!txn) { mutex_unlock(&qmi->txn_lock); mutex_unlock(&qmi->txn_lock); return; } } if (txn->dest && txn->ei) { if (txn && txn->dest && txn->ei) { ret = qmi_decode_message(buf, len, txn->ei, txn->dest); ret = qmi_decode_message(buf, len, txn->ei, txn->dest); if (ret < 0) if (ret < 0) pr_err("failed to decode incoming message\n"); pr_err("failed to decode incoming message\n"); txn->result = ret; txn->result = ret; complete(&txn->completion); complete(&txn->completion); } else { mutex_unlock(&txn->lock); } else if (txn) { qmi_invoke_handler(qmi, sq, txn, buf, len); qmi_invoke_handler(qmi, sq, txn, buf, len); } mutex_unlock(&txn->lock); mutex_unlock(&qmi->txn_lock); } else { } else { /* Create a txn based on the txn_id of the incoming message */ /* Create a txn based on the txn_id of the incoming message */ memset(&tmp_txn, 0, sizeof(tmp_txn)); memset(&tmp_txn, 0, sizeof(tmp_txn)); Loading Loading @@ -736,11 +726,9 @@ void qmi_handle_release(struct qmi_handle *qmi) mutex_lock(&qmi->txn_lock); mutex_lock(&qmi->txn_lock); idr_for_each_entry(&qmi->txns, txn, txn_id) { idr_for_each_entry(&qmi->txns, txn, txn_id) { mutex_lock(&txn->lock); idr_remove(&qmi->txns, txn->id); idr_remove(&qmi->txns, txn->id); txn->result = -ENETRESET; txn->result = -ENETRESET; complete(&txn->completion); complete(&txn->completion); mutex_unlock(&txn->lock); } } mutex_unlock(&qmi->txn_lock); mutex_unlock(&qmi->txn_lock); idr_destroy(&qmi->txns); idr_destroy(&qmi->txns); Loading
include/linux/soc/qcom/qmi.h +0 −2 Original line number Original line Diff line number Diff line Loading @@ -166,7 +166,6 @@ struct qmi_ops { * struct qmi_txn - transaction context * struct qmi_txn - transaction context * @qmi: QMI handle this transaction is associated with * @qmi: QMI handle this transaction is associated with * @id: transaction id * @id: transaction id * @lock: for synchronization between handler and waiter of messages * @completion: completion object as the transaction receives a response * @completion: completion object as the transaction receives a response * @result: result code for the completed transaction * @result: result code for the completed transaction * @ei: description of the QMI encoded response (optional) * @ei: description of the QMI encoded response (optional) Loading @@ -177,7 +176,6 @@ struct qmi_txn { u16 id; u16 id; struct mutex lock; struct completion completion; struct completion completion; int result; int result; Loading