Lines Matching defs:txn
294 * @txn: transaction context
307 int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn,
312 memset(txn, 0, sizeof(*txn));
314 mutex_init(&txn->lock);
315 init_completion(&txn->completion);
316 txn->qmi = qmi;
317 txn->ei = ei;
318 txn->dest = c_struct;
321 ret = idr_alloc_cyclic(&qmi->txns, txn, 0, U16_MAX, GFP_KERNEL);
325 txn->id = ret;
334 * @txn: transaction handle
343 int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout)
345 struct qmi_handle *qmi = txn->qmi;
348 ret = wait_for_completion_timeout(&txn->completion, timeout);
351 mutex_lock(&txn->lock);
352 idr_remove(&qmi->txns, txn->id);
353 mutex_unlock(&txn->lock);
359 return txn->result;
365 * @txn: transaction id
367 void qmi_txn_cancel(struct qmi_txn *txn)
369 struct qmi_handle *qmi = txn->qmi;
372 mutex_lock(&txn->lock);
373 idr_remove(&qmi->txns, txn->id);
374 mutex_unlock(&txn->lock);
383 * @txn: transaction object for the message
390 struct qmi_txn *txn, const void *buf, size_t len)
417 handler->fn(qmi, sq, txn, dest);
477 struct qmi_txn *txn = NULL;
490 txn = idr_find(&qmi->txns, hdr->txn_id);
493 if (!txn) {
498 mutex_lock(&txn->lock);
501 if (txn->dest && txn->ei) {
502 ret = qmi_decode_message(buf, len, txn->ei, txn->dest);
506 txn->result = ret;
507 complete(&txn->completion);
509 qmi_invoke_handler(qmi, sq, txn, buf, len);
512 mutex_unlock(&txn->lock);
514 /* Create a txn based on the txn_id of the incoming message */
723 * @txn: transaction object to use for the message
731 * with @msg_id and @txn into a buffer of maximum size @len, and sends this to
737 struct sockaddr_qrtr *sq, struct qmi_txn *txn,
748 txn->id, ei,
780 * @txn: transaction object to use for the message
789 struct qmi_txn *txn, int msg_id, size_t len,
792 return qmi_send_message(qmi, sq, txn, QMI_REQUEST, msg_id, len, ei,
801 * @txn: transaction object to use for the message
810 struct qmi_txn *txn, int msg_id, size_t len,
813 return qmi_send_message(qmi, sq, txn, QMI_RESPONSE, msg_id, len, ei,
833 struct qmi_txn txn;
837 ret = qmi_txn_init(qmi, &txn, NULL, NULL);
841 rval = qmi_send_message(qmi, sq, &txn, QMI_INDICATION, msg_id, len, ei,
844 /* We don't care about future messages on this txn */
845 qmi_txn_cancel(&txn);