Lines Matching full:txn

295  * @txn:	transaction context
308 int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn, in qmi_txn_init() argument
313 memset(txn, 0, sizeof(*txn)); in qmi_txn_init()
315 mutex_init(&txn->lock); in qmi_txn_init()
316 init_completion(&txn->completion); in qmi_txn_init()
317 txn->qmi = qmi; in qmi_txn_init()
318 txn->ei = ei; in qmi_txn_init()
319 txn->dest = c_struct; in qmi_txn_init()
322 ret = idr_alloc_cyclic(&qmi->txns, txn, 0, U16_MAX, GFP_KERNEL); in qmi_txn_init()
326 txn->id = ret; in qmi_txn_init()
335 * @txn: transaction handle
344 int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout) in qmi_txn_wait() argument
346 struct qmi_handle *qmi = txn->qmi; in qmi_txn_wait()
349 ret = wait_for_completion_timeout(&txn->completion, timeout); in qmi_txn_wait()
352 mutex_lock(&txn->lock); in qmi_txn_wait()
353 idr_remove(&qmi->txns, txn->id); in qmi_txn_wait()
354 mutex_unlock(&txn->lock); in qmi_txn_wait()
360 return txn->result; in qmi_txn_wait()
366 * @txn: transaction id
368 void qmi_txn_cancel(struct qmi_txn *txn) in qmi_txn_cancel() argument
370 struct qmi_handle *qmi = txn->qmi; in qmi_txn_cancel()
373 mutex_lock(&txn->lock); in qmi_txn_cancel()
374 idr_remove(&qmi->txns, txn->id); in qmi_txn_cancel()
375 mutex_unlock(&txn->lock); in qmi_txn_cancel()
384 * @txn: transaction object for the message
391 struct qmi_txn *txn, const void *buf, size_t len) in qmi_invoke_handler() argument
418 handler->fn(qmi, sq, txn, dest); in qmi_invoke_handler()
478 struct qmi_txn *txn = NULL; in qmi_handle_message() local
491 txn = idr_find(&qmi->txns, hdr->txn_id); in qmi_handle_message()
494 if (!txn) { in qmi_handle_message()
499 mutex_lock(&txn->lock); in qmi_handle_message()
502 if (txn->dest && txn->ei) { in qmi_handle_message()
503 ret = qmi_decode_message(buf, len, txn->ei, txn->dest); in qmi_handle_message()
507 txn->result = ret; in qmi_handle_message()
508 complete(&txn->completion); in qmi_handle_message()
510 qmi_invoke_handler(qmi, sq, txn, buf, len); in qmi_handle_message()
513 mutex_unlock(&txn->lock); in qmi_handle_message()
515 /* Create a txn based on the txn_id of the incoming message */ in qmi_handle_message()
726 * @txn: transaction object to use for the message
734 * with @msg_id and @txn into a buffer of maximum size @len, and sends this to
740 struct sockaddr_qrtr *sq, struct qmi_txn *txn, in qmi_send_message() argument
752 txn->id, ei, in qmi_send_message()
784 * @txn: transaction object to use for the message
793 struct qmi_txn *txn, int msg_id, size_t len, in qmi_send_request() argument
796 return qmi_send_message(qmi, sq, txn, QMI_REQUEST, msg_id, len, ei, in qmi_send_request()
805 * @txn: transaction object to use for the message
814 struct qmi_txn *txn, int msg_id, size_t len, in qmi_send_response() argument
817 return qmi_send_message(qmi, sq, txn, QMI_RESPONSE, msg_id, len, ei, in qmi_send_response()
838 struct qmi_txn txn; in qmi_send_indication() local
842 ret = qmi_txn_init(qmi, &txn, NULL, NULL); in qmi_send_indication()
846 rval = qmi_send_message(qmi, sq, &txn, QMI_INDICATION, msg_id, len, ei, in qmi_send_indication()
849 /* We don't care about future messages on this txn */ in qmi_send_indication()
850 qmi_txn_cancel(&txn); in qmi_send_indication()