int open_vctx(struct file *file, struct fimc_is_video *video, struct fimc_is_video_ctx **vctx, u32 instance, u32 id) { int ret = 0; BUG_ON(!file); BUG_ON(!video); if (atomic_read(&video->refcount) > FIMC_IS_MAX_NODES) { err("can't open vctx, refcount is invalid"); ret = -EINVAL; goto p_err; } *vctx = kzalloc(sizeof(struct fimc_is_video_ctx), GFP_KERNEL); if (*vctx == NULL) { err("kzalloc is fail"); ret = -ENOMEM; goto p_err; } (*vctx)->refcount = vref_get(video); (*vctx)->instance = instance; (*vctx)->queue.id = id; (*vctx)->state = BIT(FIMC_IS_VIDEO_CLOSE); file->private_data = *vctx; p_err: return ret; }
int open_vctx(struct file *file, struct fimc_is_video *video, struct fimc_is_video_ctx **vctx, u32 id_src, u32 id_dst) { int ret = 0; BUG_ON(!file); BUG_ON(!video); if (atomic_read(&video->refcount) > FIMC_IS_MAX_NODES) { err("can't open vctx, refcount is invalid"); ret = -EINVAL; goto exit; } *vctx = kzalloc(sizeof(struct fimc_is_video_ctx), GFP_KERNEL); if (*vctx == NULL) { err("kzalloc is fail"); ret = -ENOMEM; *vctx = NULL; goto exit; } (*vctx)->instance = vref_get(video); (*vctx)->q_src.id = id_src; (*vctx)->q_dst.id = id_dst; file->private_data = *vctx; exit: return ret; }