Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c781e4a5 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] media/platform: convert drivers to use the new vb2_queue dev field



Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 8e9bca3a
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -1123,20 +1123,13 @@ static int gsc_probe(struct platform_device *pdev)
	if (ret < 0)
		goto err_m2m;

	/* Initialize continious memory allocator */
	vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
	gsc->alloc_ctx = vb2_dma_contig_init_ctx(dev);
	if (IS_ERR(gsc->alloc_ctx)) {
		ret = PTR_ERR(gsc->alloc_ctx);
		goto err_pm;
	}

	dev_dbg(dev, "gsc-%d registered successfully\n", gsc->id);

	pm_runtime_put(dev);
	return 0;
err_pm:
	pm_runtime_put(dev);

err_m2m:
	gsc_unregister_m2m_device(gsc);
err_v4l2:
@@ -1153,7 +1146,6 @@ static int gsc_remove(struct platform_device *pdev)
	gsc_unregister_m2m_device(gsc);
	v4l2_device_unregister(&gsc->v4l2_dev);

	vb2_dma_contig_cleanup_ctx(gsc->alloc_ctx);
	vb2_dma_contig_clear_max_seg_size(&pdev->dev);
	pm_runtime_disable(&pdev->dev);
	gsc_clk_put(gsc);
+0 −1
Original line number Diff line number Diff line
@@ -341,7 +341,6 @@ struct gsc_dev {
	wait_queue_head_t		irq_queue;
	struct gsc_m2m_device		m2m;
	unsigned long			state;
	struct vb2_alloc_ctx		*alloc_ctx;
	struct video_device		vdev;
	struct v4l2_device		v4l2_dev;
};
+3 −3
Original line number Diff line number Diff line
@@ -227,10 +227,8 @@ static int gsc_m2m_queue_setup(struct vb2_queue *vq,
		return -EINVAL;

	*num_planes = frame->fmt->num_planes;
	for (i = 0; i < frame->fmt->num_planes; i++) {
	for (i = 0; i < frame->fmt->num_planes; i++)
		sizes[i] = frame->payload[i];
		allocators[i] = ctx->gsc_dev->alloc_ctx;
	}
	return 0;
}

@@ -591,6 +589,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
	src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
	src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
	src_vq->lock = &ctx->gsc_dev->lock;
	src_vq->dev = &ctx->gsc_dev->pdev->dev;

	ret = vb2_queue_init(src_vq);
	if (ret)
@@ -605,6 +604,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
	dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
	dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
	dst_vq->lock = &ctx->gsc_dev->lock;
	dst_vq->dev = &ctx->gsc_dev->pdev->dev;

	return vb2_queue_init(dst_vq);
}
+1 −2
Original line number Diff line number Diff line
@@ -440,7 +440,6 @@ static int queue_setup(struct vb2_queue *vq,
		       unsigned int sizes[], void *allocators[])
{
	struct camif_vp *vp = vb2_get_drv_priv(vq);
	struct camif_dev *camif = vp->camif;
	struct camif_frame *frame = &vp->out_frame;
	const struct camif_fmt *fmt = vp->out_fmt;
	unsigned int size;
@@ -449,7 +448,6 @@ static int queue_setup(struct vb2_queue *vq,
		return -EINVAL;

	size = (frame->f_width * frame->f_height * fmt->depth) / 8;
	allocators[0] = camif->alloc_ctx;

	if (*num_planes)
		return sizes[0] < size ? -EINVAL : 0;
@@ -1138,6 +1136,7 @@ int s3c_camif_register_video_node(struct camif_dev *camif, int idx)
	q->drv_priv = vp;
	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
	q->lock = &vp->camif->lock;
	q->dev = camif->v4l2_dev.dev;

	ret = vb2_queue_init(q);
	if (ret)
+1 −10
Original line number Diff line number Diff line
@@ -474,16 +474,9 @@ static int s3c_camif_probe(struct platform_device *pdev)
	if (ret < 0)
		goto err_pm;

	/* Initialize contiguous memory allocator */
	camif->alloc_ctx = vb2_dma_contig_init_ctx(dev);
	if (IS_ERR(camif->alloc_ctx)) {
		ret = PTR_ERR(camif->alloc_ctx);
		goto err_alloc;
	}

	ret = camif_media_dev_init(camif);
	if (ret < 0)
		goto err_mdev;
		goto err_alloc;

	ret = camif_register_sensor(camif);
	if (ret < 0)
@@ -517,8 +510,6 @@ static int s3c_camif_probe(struct platform_device *pdev)
	media_device_unregister(&camif->media_dev);
	media_device_cleanup(&camif->media_dev);
	camif_unregister_media_entities(camif);
err_mdev:
	vb2_dma_contig_cleanup_ctx(camif->alloc_ctx);
err_alloc:
	pm_runtime_put(dev);
	pm_runtime_disable(dev);
Loading