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()
914 struct fastrpc_channel_ctx *cctx; in fastrpc_invoke_send() local
919 cctx = fl->cctx; in fastrpc_invoke_send()
933 ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); in fastrpc_invoke_send()
952 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
1128 struct fastrpc_channel_ctx *cctx) in fastrpc_session_alloc() argument
1134 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_alloc()
1135 for (i = 0; i < cctx->sesscount; i++) { in fastrpc_session_alloc()
1136 if (!cctx->session[i].used && cctx->session[i].valid) { in fastrpc_session_alloc()
1137 cctx->session[i].used = true; in fastrpc_session_alloc()
1138 session = &cctx->session[i]; in fastrpc_session_alloc()
1142 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_alloc()
1147 static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, in fastrpc_session_free() argument
1152 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_free()
1154 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_free()
1177 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release() local
1185 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_release()
1187 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_release()
1207 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1208 fastrpc_channel_ctx_put(cctx); in fastrpc_device_release()
1219 struct fastrpc_channel_ctx *cctx = miscdev_to_cctx(filp->private_data); in fastrpc_device_open() local
1228 fastrpc_channel_ctx_get(cctx); in fastrpc_device_open()
1238 fl->cctx = cctx; in fastrpc_device_open()
1240 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1242 dev_err(&cctx->rpdev->dev, "No session available\n"); in fastrpc_device_open()
1249 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_open()
1250 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1251 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_open()
1529 struct fastrpc_channel_ctx *cctx; in fastrpc_cb_probe() local
1536 cctx = dev_get_drvdata(dev->parent); in fastrpc_cb_probe()
1537 if (!cctx) in fastrpc_cb_probe()
1542 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_probe()
1543 sess = &cctx->session[cctx->sesscount]; in fastrpc_cb_probe()
1556 if (cctx->sesscount++ >= FASTRPC_MAX_SESSIONS) in fastrpc_cb_probe()
1558 dup_sess = &cctx->session[cctx->sesscount]; in fastrpc_cb_probe()
1562 cctx->sesscount++; in fastrpc_cb_probe()
1563 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
1575 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); in fastrpc_cb_remove() local
1580 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_remove()
1582 if (cctx->session[i].sid == sess->sid) { in fastrpc_cb_remove()
1583 cctx->session[i].valid = false; in fastrpc_cb_remove()
1584 cctx->sesscount--; in fastrpc_cb_remove()
1587 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_remove()
1671 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_remove() local
1675 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_remove()
1676 list_for_each_entry(user, &cctx->users, user) in fastrpc_rpmsg_remove()
1678 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_remove()
1680 misc_deregister(&cctx->miscdev); in fastrpc_rpmsg_remove()
1683 cctx->rpdev = NULL; in fastrpc_rpmsg_remove()
1684 fastrpc_channel_ctx_put(cctx); in fastrpc_rpmsg_remove()
1690 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_callback() local
1701 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_callback()
1702 ctx = idr_find(&cctx->ctx_idr, ctxid); in fastrpc_rpmsg_callback()
1703 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_callback()