Lines Matching refs:cctx

197 	struct fastrpc_channel_ctx *cctx;  member
225 struct fastrpc_channel_ctx *cctx; member
329 struct fastrpc_channel_ctx *cctx; in fastrpc_channel_ctx_free() local
331 cctx = container_of(ref, struct fastrpc_channel_ctx, refcount); in fastrpc_channel_ctx_free()
333 kfree(cctx); in fastrpc_channel_ctx_free()
336 static void fastrpc_channel_ctx_get(struct fastrpc_channel_ctx *cctx) in fastrpc_channel_ctx_get() argument
338 kref_get(&cctx->refcount); in fastrpc_channel_ctx_get()
341 static void fastrpc_channel_ctx_put(struct fastrpc_channel_ctx *cctx) in fastrpc_channel_ctx_put() argument
343 kref_put(&cctx->refcount, fastrpc_channel_ctx_free); in fastrpc_channel_ctx_put()
349 struct fastrpc_channel_ctx *cctx; in fastrpc_context_free() local
354 cctx = ctx->cctx; in fastrpc_context_free()
362 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_context_free()
363 idr_remove(&cctx->ctx_idr, ctx->ctxid >> 4); in fastrpc_context_free()
364 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_free()
370 fastrpc_channel_ctx_put(cctx); in fastrpc_context_free()
444 struct fastrpc_channel_ctx *cctx = user->cctx; in fastrpc_context_alloc() local
478 fastrpc_channel_ctx_get(cctx); in fastrpc_context_alloc()
484 ctx->cctx = cctx; in fastrpc_context_alloc()
492 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_context_alloc()
493 ret = idr_alloc_cyclic(&cctx->ctx_idr, ctx, 1, in fastrpc_context_alloc()
496 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_alloc()
500 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_context_alloc()
509 fastrpc_channel_ctx_put(cctx); in fastrpc_context_alloc()
909 struct fastrpc_channel_ctx *cctx; in fastrpc_invoke_send() local
914 cctx = fl->cctx; in fastrpc_invoke_send()
928 ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); in fastrpc_invoke_send()
947 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
1118 struct fastrpc_channel_ctx *cctx) in fastrpc_session_alloc() argument
1124 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_alloc()
1125 for (i = 0; i < cctx->sesscount; i++) { in fastrpc_session_alloc()
1126 if (!cctx->session[i].used && cctx->session[i].valid) { in fastrpc_session_alloc()
1127 cctx->session[i].used = true; in fastrpc_session_alloc()
1128 session = &cctx->session[i]; in fastrpc_session_alloc()
1132 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_alloc()
1137 static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, in fastrpc_session_free() argument
1142 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_free()
1144 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_free()
1167 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release() local
1175 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_release()
1177 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_release()
1197 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1198 fastrpc_channel_ctx_put(cctx); in fastrpc_device_release()
1209 struct fastrpc_channel_ctx *cctx = miscdev_to_cctx(filp->private_data); in fastrpc_device_open() local
1218 fastrpc_channel_ctx_get(cctx); in fastrpc_device_open()
1228 fl->cctx = cctx; in fastrpc_device_open()
1230 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1232 dev_err(&cctx->rpdev->dev, "No session available\n"); in fastrpc_device_open()
1239 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_open()
1240 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1241 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_open()
1519 struct fastrpc_channel_ctx *cctx; in fastrpc_cb_probe() local
1526 cctx = dev_get_drvdata(dev->parent); in fastrpc_cb_probe()
1527 if (!cctx) in fastrpc_cb_probe()
1532 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_probe()
1533 sess = &cctx->session[cctx->sesscount]; in fastrpc_cb_probe()
1546 if (cctx->sesscount++ >= FASTRPC_MAX_SESSIONS) in fastrpc_cb_probe()
1548 dup_sess = &cctx->session[cctx->sesscount]; in fastrpc_cb_probe()
1552 cctx->sesscount++; in fastrpc_cb_probe()
1553 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
1565 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); in fastrpc_cb_remove() local
1570 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_remove()
1572 if (cctx->session[i].sid == sess->sid) { in fastrpc_cb_remove()
1573 cctx->session[i].valid = false; in fastrpc_cb_remove()
1574 cctx->sesscount--; in fastrpc_cb_remove()
1577 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_remove()
1661 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_remove() local
1665 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_remove()
1666 list_for_each_entry(user, &cctx->users, user) in fastrpc_rpmsg_remove()
1668 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_remove()
1670 misc_deregister(&cctx->miscdev); in fastrpc_rpmsg_remove()
1673 cctx->rpdev = NULL; in fastrpc_rpmsg_remove()
1674 fastrpc_channel_ctx_put(cctx); in fastrpc_rpmsg_remove()
1680 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_callback() local
1691 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_callback()
1692 ctx = idr_find(&cctx->ctx_idr, ctxid); in fastrpc_rpmsg_callback()
1693 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_callback()