summaryrefslogtreecommitdiff
path: root/drivers/media/platform/rockchip/rkvdec/rkvdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/rockchip/rkvdec/rkvdec.c')
-rw-r--r--drivers/media/platform/rockchip/rkvdec/rkvdec.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
index d707088ec0dc..6e606d73ff51 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
@@ -354,7 +354,7 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
- struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv);
+ struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(file);
const struct rkvdec_coded_fmt_desc *coded_desc;
/*
@@ -387,7 +387,7 @@ static int rkvdec_try_output_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
- struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv);
+ struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(file);
const struct rkvdec_coded_fmt_desc *desc;
desc = rkvdec_find_coded_fmt_desc(pix_mp->pixelformat);
@@ -418,7 +418,7 @@ static int rkvdec_try_output_fmt(struct file *file, void *priv,
static int rkvdec_s_capture_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv);
+ struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(file);
struct vb2_queue *vq;
int ret;
@@ -439,7 +439,7 @@ static int rkvdec_s_capture_fmt(struct file *file, void *priv,
static int rkvdec_s_output_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv);
+ struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(file);
struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;
const struct rkvdec_coded_fmt_desc *desc;
struct v4l2_format *cap_fmt;
@@ -504,7 +504,7 @@ static int rkvdec_s_output_fmt(struct file *file, void *priv,
static int rkvdec_g_output_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv);
+ struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(file);
*f = ctx->coded_fmt;
return 0;
@@ -513,7 +513,7 @@ static int rkvdec_g_output_fmt(struct file *file, void *priv,
static int rkvdec_g_capture_fmt(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv);
+ struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(file);
*f = ctx->decoded_fmt;
return 0;
@@ -532,7 +532,7 @@ static int rkvdec_enum_output_fmt(struct file *file, void *priv,
static int rkvdec_enum_capture_fmt(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
- struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv);
+ struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(file);
u32 fourcc;
fourcc = rkvdec_enum_decoded_fmt(ctx, f->index, ctx->image_fmt);
@@ -765,7 +765,6 @@ static void rkvdec_job_finish(struct rkvdec_ctx *ctx,
{
struct rkvdec_dev *rkvdec = ctx->dev;
- pm_runtime_mark_last_busy(rkvdec->dev);
pm_runtime_put_autosuspend(rkvdec->dev);
rkvdec_job_finish_no_pm(ctx, result);
}
@@ -938,8 +937,7 @@ static int rkvdec_open(struct file *filp)
if (ret)
goto err_cleanup_m2m_ctx;
- filp->private_data = &ctx->fh;
- v4l2_fh_add(&ctx->fh);
+ v4l2_fh_add(&ctx->fh, filp);
return 0;
@@ -953,9 +951,9 @@ err_free_ctx:
static int rkvdec_release(struct file *filp)
{
- struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(filp->private_data);
+ struct rkvdec_ctx *ctx = file_to_rkvdec_ctx(filp);
- v4l2_fh_del(&ctx->fh);
+ v4l2_fh_del(&ctx->fh, filp);
v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
v4l2_fh_exit(&ctx->fh);
@@ -1159,13 +1157,6 @@ static int rkvdec_probe(struct platform_device *pdev)
return ret;
}
- if (iommu_get_domain_for_dev(&pdev->dev)) {
- rkvdec->empty_domain = iommu_paging_domain_alloc(rkvdec->dev);
-
- if (!rkvdec->empty_domain)
- dev_warn(rkvdec->dev, "cannot alloc new empty domain\n");
- }
-
vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
irq = platform_get_irq(pdev, 0);
@@ -1188,6 +1179,15 @@ static int rkvdec_probe(struct platform_device *pdev)
if (ret)
goto err_disable_runtime_pm;
+ if (iommu_get_domain_for_dev(&pdev->dev)) {
+ rkvdec->empty_domain = iommu_paging_domain_alloc(rkvdec->dev);
+
+ if (IS_ERR(rkvdec->empty_domain)) {
+ rkvdec->empty_domain = NULL;
+ dev_warn(rkvdec->dev, "cannot alloc new empty domain\n");
+ }
+ }
+
return 0;
err_disable_runtime_pm: