Lines Matching defs:txn

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