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()
1537 struct fastrpc_channel_ctx *cctx; in fastrpc_cb_probe() local
1544 cctx = dev_get_drvdata(dev->parent); in fastrpc_cb_probe()
1545 if (!cctx) in fastrpc_cb_probe()
1550 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_probe()
1551 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) { in fastrpc_cb_probe()
1553 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
1556 sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
1569 if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) in fastrpc_cb_probe()
1571 dup_sess = &cctx->session[cctx->sesscount++]; in fastrpc_cb_probe()
1575 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
1587 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); in fastrpc_cb_remove() local
1592 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_remove()
1594 if (cctx->session[i].sid == sess->sid) { in fastrpc_cb_remove()
1595 cctx->session[i].valid = false; in fastrpc_cb_remove()
1596 cctx->sesscount--; in fastrpc_cb_remove()
1599 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_remove()
1683 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_remove() local
1687 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_remove()
1688 list_for_each_entry(user, &cctx->users, user) in fastrpc_rpmsg_remove()
1690 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_remove()
1692 misc_deregister(&cctx->miscdev); in fastrpc_rpmsg_remove()
1695 cctx->rpdev = NULL; in fastrpc_rpmsg_remove()
1696 fastrpc_channel_ctx_put(cctx); in fastrpc_rpmsg_remove()
1702 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_callback() local
1713 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_callback()
1714 ctx = idr_find(&cctx->ctx_idr, ctxid); in fastrpc_rpmsg_callback()
1715 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_callback()