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()
918 struct fastrpc_channel_ctx *cctx; in fastrpc_invoke_send() local
923 cctx = fl->cctx; in fastrpc_invoke_send()
937 ret = rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); in fastrpc_invoke_send()
956 if (!fl->cctx->rpdev) in fastrpc_internal_invoke()
1132 struct fastrpc_channel_ctx *cctx) in fastrpc_session_alloc() argument
1138 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_alloc()
1139 for (i = 0; i < cctx->sesscount; i++) { in fastrpc_session_alloc()
1140 if (!cctx->session[i].used && cctx->session[i].valid) { in fastrpc_session_alloc()
1141 cctx->session[i].used = true; in fastrpc_session_alloc()
1142 session = &cctx->session[i]; in fastrpc_session_alloc()
1146 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_alloc()
1151 static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, in fastrpc_session_free() argument
1156 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_session_free()
1158 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_session_free()
1181 struct fastrpc_channel_ctx *cctx = fl->cctx; in fastrpc_device_release() local
1189 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_release()
1191 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_release()
1211 fastrpc_session_free(cctx, fl->sctx); in fastrpc_device_release()
1212 fastrpc_channel_ctx_put(cctx); in fastrpc_device_release()
1223 struct fastrpc_channel_ctx *cctx = miscdev_to_cctx(filp->private_data); in fastrpc_device_open() local
1232 fastrpc_channel_ctx_get(cctx); in fastrpc_device_open()
1242 fl->cctx = cctx; in fastrpc_device_open()
1244 fl->sctx = fastrpc_session_alloc(cctx); in fastrpc_device_open()
1246 dev_err(&cctx->rpdev->dev, "No session available\n"); in fastrpc_device_open()
1253 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_device_open()
1254 list_add_tail(&fl->user, &cctx->users); in fastrpc_device_open()
1255 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_device_open()
1533 struct fastrpc_channel_ctx *cctx; in fastrpc_cb_probe() local
1540 cctx = dev_get_drvdata(dev->parent); in fastrpc_cb_probe()
1541 if (!cctx) in fastrpc_cb_probe()
1546 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_probe()
1547 sess = &cctx->session[cctx->sesscount]; in fastrpc_cb_probe()
1560 if (cctx->sesscount++ >= FASTRPC_MAX_SESSIONS) in fastrpc_cb_probe()
1562 dup_sess = &cctx->session[cctx->sesscount]; in fastrpc_cb_probe()
1566 cctx->sesscount++; in fastrpc_cb_probe()
1567 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_probe()
1579 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); in fastrpc_cb_remove() local
1584 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_cb_remove()
1586 if (cctx->session[i].sid == sess->sid) { in fastrpc_cb_remove()
1587 cctx->session[i].valid = false; in fastrpc_cb_remove()
1588 cctx->sesscount--; in fastrpc_cb_remove()
1591 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_cb_remove()
1675 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_remove() local
1679 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_remove()
1680 list_for_each_entry(user, &cctx->users, user) in fastrpc_rpmsg_remove()
1682 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_remove()
1684 misc_deregister(&cctx->miscdev); in fastrpc_rpmsg_remove()
1687 cctx->rpdev = NULL; in fastrpc_rpmsg_remove()
1688 fastrpc_channel_ctx_put(cctx); in fastrpc_rpmsg_remove()
1694 struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); in fastrpc_rpmsg_callback() local
1705 spin_lock_irqsave(&cctx->lock, flags); in fastrpc_rpmsg_callback()
1706 ctx = idr_find(&cctx->ctx_idr, ctxid); in fastrpc_rpmsg_callback()
1707 spin_unlock_irqrestore(&cctx->lock, flags); in fastrpc_rpmsg_callback()