Lines Matching refs:txn
307 int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn, in qmi_txn_init() argument
312 memset(txn, 0, sizeof(*txn)); in qmi_txn_init()
314 mutex_init(&txn->lock); in qmi_txn_init()
315 init_completion(&txn->completion); in qmi_txn_init()
316 txn->qmi = qmi; in qmi_txn_init()
317 txn->ei = ei; in qmi_txn_init()
318 txn->dest = c_struct; in qmi_txn_init()
321 ret = idr_alloc_cyclic(&qmi->txns, txn, 0, U16_MAX, GFP_KERNEL); in qmi_txn_init()
325 txn->id = ret; in qmi_txn_init()
343 int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout) in qmi_txn_wait() argument
345 struct qmi_handle *qmi = txn->qmi; in qmi_txn_wait()
348 ret = wait_for_completion_timeout(&txn->completion, timeout); in qmi_txn_wait()
351 mutex_lock(&txn->lock); in qmi_txn_wait()
352 idr_remove(&qmi->txns, txn->id); in qmi_txn_wait()
353 mutex_unlock(&txn->lock); in qmi_txn_wait()
359 return txn->result; in qmi_txn_wait()
367 void qmi_txn_cancel(struct qmi_txn *txn) in qmi_txn_cancel() argument
369 struct qmi_handle *qmi = txn->qmi; in qmi_txn_cancel()
372 mutex_lock(&txn->lock); in qmi_txn_cancel()
373 idr_remove(&qmi->txns, txn->id); in qmi_txn_cancel()
374 mutex_unlock(&txn->lock); in qmi_txn_cancel()
390 struct qmi_txn *txn, const void *buf, size_t len) in qmi_invoke_handler() argument
417 handler->fn(qmi, sq, txn, dest); in qmi_invoke_handler()
477 struct qmi_txn *txn = NULL; in qmi_handle_message() local
490 txn = idr_find(&qmi->txns, hdr->txn_id); in qmi_handle_message()
493 if (!txn) { in qmi_handle_message()
498 mutex_lock(&txn->lock); in qmi_handle_message()
501 if (txn->dest && txn->ei) { in qmi_handle_message()
502 ret = qmi_decode_message(buf, len, txn->ei, txn->dest); in qmi_handle_message()
506 txn->result = ret; in qmi_handle_message()
507 complete(&txn->completion); in qmi_handle_message()
509 qmi_invoke_handler(qmi, sq, txn, buf, len); in qmi_handle_message()
512 mutex_unlock(&txn->lock); in qmi_handle_message()
733 struct sockaddr_qrtr *sq, struct qmi_txn *txn, in qmi_send_message() argument
744 txn->id, ei, in qmi_send_message()
785 struct qmi_txn *txn, int msg_id, size_t len, in qmi_send_request() argument
788 return qmi_send_message(qmi, sq, txn, QMI_REQUEST, msg_id, len, ei, in qmi_send_request()
806 struct qmi_txn *txn, int msg_id, size_t len, in qmi_send_response() argument
809 return qmi_send_message(qmi, sq, txn, QMI_RESPONSE, msg_id, len, ei, in qmi_send_response()
829 struct qmi_txn txn; in qmi_send_indication() local
833 ret = qmi_txn_init(qmi, &txn, NULL, NULL); in qmi_send_indication()
837 rval = qmi_send_message(qmi, sq, &txn, QMI_INDICATION, msg_id, len, ei, in qmi_send_indication()
841 qmi_txn_cancel(&txn); in qmi_send_indication()