All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	Kieran Bingham <kieran@ksquared.org.uk>
Subject: [PATCH v3 05/10] v4l: fdp1: vb2_queue dev conversion
Date: Thu,  8 Sep 2016 01:25:05 +0300	[thread overview]
Message-ID: <1473287110-780-6-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw)
In-Reply-To: <1473287110-780-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

From: Geert Uytterhoeven <geert+renesas@glider.be>

    drivers/media/platform/rcar_fdp1.c:1972:2: warning: initialization from incompatible pointer type
      .queue_setup  = fdp1_queue_setup,
      ^
    drivers/media/platform/rcar_fdp1.c:1972:2: warning: (near initialization for 'fdp1_qops.queue_setup')
    drivers/media/platform/rcar_fdp1.c: In function 'fdp1_probe':
    drivers/media/platform/rcar_fdp1.c:2264:2: error: implicit declaration of function 'vb2_dma_contig_init_ctx' [-Werror=implicit-function-declaration]
      fdp1->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
      ^
    drivers/media/platform/rcar_fdp1.c:2264:18: warning: assignment makes pointer from integer without a cast
      fdp1->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
		      ^
    drivers/media/platform/rcar_fdp1.c:2331:2: error: implicit declaration of function 'vb2_dma_contig_cleanup_ctx' [-Werror=implicit-function-declaration]
      vb2_dma_contig_cleanup_ctx(fdp1->alloc_ctx);
      ^

Commit 36c0f8b32c4bd4f6 ("[media] vb2: replace void *alloc_ctxs by
struct device *alloc_devs") removed the vb2_dma_contig_init_ctx() and
vb2_dma_contig_cleanup_ctx() functions, and changed the prototype of
vb2_ops.queue_setup().

To fix this:
  - Update the signature of fdp1_queue_setup(),
  - Convert the FDP1 driver to use the new vb2_queue dev field, cfr.
    commit 53ddcc683faef8c7 ("[media] media/platform: convert drivers to
    use the new vb2_queue dev field").

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/media/platform/rcar_fdp1.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c
index c7280183262a..a2587745ca68 100644
--- a/drivers/media/platform/rcar_fdp1.c
+++ b/drivers/media/platform/rcar_fdp1.c
@@ -570,7 +570,6 @@ struct fdp1_dev {
 	void __iomem		*regs;
 	unsigned int		irq;
 	struct device		*dev;
-	void			*alloc_ctx;
 
 	/* Job Queues */
 	struct fdp1_job		jobs[FDP1_NUMBER_JOBS];
@@ -1788,7 +1787,8 @@ static const struct v4l2_ioctl_ops fdp1_ioctl_ops = {
 
 static int fdp1_queue_setup(struct vb2_queue *vq,
 				unsigned int *nbuffers, unsigned int *nplanes,
-				unsigned int sizes[], void *alloc_ctxs[])
+				unsigned int sizes[],
+				struct device *alloc_ctxs[])
 {
 	struct fdp1_ctx *ctx = vb2_get_drv_priv(vq);
 	struct fdp1_q_data *q_data;
@@ -1800,18 +1800,13 @@ static int fdp1_queue_setup(struct vb2_queue *vq,
 		if (*nplanes > FDP1_MAX_PLANES)
 			return -EINVAL;
 
-		for (i = 0; i < *nplanes; i++)
-			alloc_ctxs[i] = ctx->fdp1->alloc_ctx;
-
 		return 0;
 	}
 
 	*nplanes = q_data->format.num_planes;
 
-	for (i = 0; i < *nplanes; i++) {
+	for (i = 0; i < *nplanes; i++)
 		sizes[i] = q_data->format.plane_fmt[i].sizeimage;
-		alloc_ctxs[i] = ctx->fdp1->alloc_ctx;
-	}
 
 	return 0;
 }
@@ -1992,6 +1987,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
 	src_vq->mem_ops = &vb2_dma_contig_memops;
 	src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	src_vq->lock = &ctx->fdp1->dev_mutex;
+	src_vq->dev = ctx->fdp1->dev;
 
 	ret = vb2_queue_init(src_vq);
 	if (ret)
@@ -2005,6 +2001,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
 	dst_vq->mem_ops = &vb2_dma_contig_memops;
 	dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	dst_vq->lock = &ctx->fdp1->dev_mutex;
+	dst_vq->dev = ctx->fdp1->dev;
 
 	return vb2_queue_init(dst_vq);
 }
@@ -2260,18 +2257,11 @@ static int fdp1_probe(struct platform_device *pdev)
 	fdp1->clk_rate = clk_get_rate(clk);
 	clk_put(clk);
 
-	/* Memory allocation contexts */
-	fdp1->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
-	if (IS_ERR(fdp1->alloc_ctx)) {
-		v4l2_err(&fdp1->v4l2_dev, "Failed to init memory allocator\n");
-		return PTR_ERR(fdp1->alloc_ctx);
-	}
-
 	/* V4L2 device registration */
 	ret = v4l2_device_register(&pdev->dev, &fdp1->v4l2_dev);
 	if (ret) {
 		v4l2_err(&fdp1->v4l2_dev, "Failed to register video device\n");
-		goto vb2_allocator_rollback;
+		return ret;
 	}
 
 	/* M2M registration */
@@ -2327,9 +2317,6 @@ release_m2m:
 unreg_dev:
 	v4l2_device_unregister(&fdp1->v4l2_dev);
 
-vb2_allocator_rollback:
-	vb2_dma_contig_cleanup_ctx(fdp1->alloc_ctx);
-
 	return ret;
 }
 
@@ -2340,7 +2327,6 @@ static int fdp1_remove(struct platform_device *pdev)
 	v4l2_m2m_release(fdp1->m2m_dev);
 	video_unregister_device(&fdp1->vfd);
 	v4l2_device_unregister(&fdp1->v4l2_dev);
-	vb2_dma_contig_cleanup_ctx(fdp1->alloc_ctx);
 	pm_runtime_disable(&pdev->dev);
 
 	return 0;
-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org, Kieran Bingham <kieran@bingham.xyz>
Subject: [PATCH v3 05/10] v4l: fdp1: vb2_queue dev conversion
Date: Thu,  8 Sep 2016 01:25:05 +0300	[thread overview]
Message-ID: <1473287110-780-6-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw)
In-Reply-To: <1473287110-780-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

From: Geert Uytterhoeven <geert+renesas@glider.be>

    drivers/media/platform/rcar_fdp1.c:1972:2: warning: initialization from incompatible pointer type
      .queue_setup  = fdp1_queue_setup,
      ^
    drivers/media/platform/rcar_fdp1.c:1972:2: warning: (near initialization for 'fdp1_qops.queue_setup')
    drivers/media/platform/rcar_fdp1.c: In function 'fdp1_probe':
    drivers/media/platform/rcar_fdp1.c:2264:2: error: implicit declaration of function 'vb2_dma_contig_init_ctx' [-Werror=implicit-function-declaration]
      fdp1->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
      ^
    drivers/media/platform/rcar_fdp1.c:2264:18: warning: assignment makes pointer from integer without a cast
      fdp1->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
		      ^
    drivers/media/platform/rcar_fdp1.c:2331:2: error: implicit declaration of function 'vb2_dma_contig_cleanup_ctx' [-Werror=implicit-function-declaration]
      vb2_dma_contig_cleanup_ctx(fdp1->alloc_ctx);
      ^

Commit 36c0f8b32c4bd4f6 ("[media] vb2: replace void *alloc_ctxs by
struct device *alloc_devs") removed the vb2_dma_contig_init_ctx() and
vb2_dma_contig_cleanup_ctx() functions, and changed the prototype of
vb2_ops.queue_setup().

To fix this:
  - Update the signature of fdp1_queue_setup(),
  - Convert the FDP1 driver to use the new vb2_queue dev field, cfr.
    commit 53ddcc683faef8c7 ("[media] media/platform: convert drivers to
    use the new vb2_queue dev field").

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/media/platform/rcar_fdp1.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c
index c7280183262a..a2587745ca68 100644
--- a/drivers/media/platform/rcar_fdp1.c
+++ b/drivers/media/platform/rcar_fdp1.c
@@ -570,7 +570,6 @@ struct fdp1_dev {
 	void __iomem		*regs;
 	unsigned int		irq;
 	struct device		*dev;
-	void			*alloc_ctx;
 
 	/* Job Queues */
 	struct fdp1_job		jobs[FDP1_NUMBER_JOBS];
@@ -1788,7 +1787,8 @@ static const struct v4l2_ioctl_ops fdp1_ioctl_ops = {
 
 static int fdp1_queue_setup(struct vb2_queue *vq,
 				unsigned int *nbuffers, unsigned int *nplanes,
-				unsigned int sizes[], void *alloc_ctxs[])
+				unsigned int sizes[],
+				struct device *alloc_ctxs[])
 {
 	struct fdp1_ctx *ctx = vb2_get_drv_priv(vq);
 	struct fdp1_q_data *q_data;
@@ -1800,18 +1800,13 @@ static int fdp1_queue_setup(struct vb2_queue *vq,
 		if (*nplanes > FDP1_MAX_PLANES)
 			return -EINVAL;
 
-		for (i = 0; i < *nplanes; i++)
-			alloc_ctxs[i] = ctx->fdp1->alloc_ctx;
-
 		return 0;
 	}
 
 	*nplanes = q_data->format.num_planes;
 
-	for (i = 0; i < *nplanes; i++) {
+	for (i = 0; i < *nplanes; i++)
 		sizes[i] = q_data->format.plane_fmt[i].sizeimage;
-		alloc_ctxs[i] = ctx->fdp1->alloc_ctx;
-	}
 
 	return 0;
 }
@@ -1992,6 +1987,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
 	src_vq->mem_ops = &vb2_dma_contig_memops;
 	src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	src_vq->lock = &ctx->fdp1->dev_mutex;
+	src_vq->dev = ctx->fdp1->dev;
 
 	ret = vb2_queue_init(src_vq);
 	if (ret)
@@ -2005,6 +2001,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
 	dst_vq->mem_ops = &vb2_dma_contig_memops;
 	dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	dst_vq->lock = &ctx->fdp1->dev_mutex;
+	dst_vq->dev = ctx->fdp1->dev;
 
 	return vb2_queue_init(dst_vq);
 }
@@ -2260,18 +2257,11 @@ static int fdp1_probe(struct platform_device *pdev)
 	fdp1->clk_rate = clk_get_rate(clk);
 	clk_put(clk);
 
-	/* Memory allocation contexts */
-	fdp1->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
-	if (IS_ERR(fdp1->alloc_ctx)) {
-		v4l2_err(&fdp1->v4l2_dev, "Failed to init memory allocator\n");
-		return PTR_ERR(fdp1->alloc_ctx);
-	}
-
 	/* V4L2 device registration */
 	ret = v4l2_device_register(&pdev->dev, &fdp1->v4l2_dev);
 	if (ret) {
 		v4l2_err(&fdp1->v4l2_dev, "Failed to register video device\n");
-		goto vb2_allocator_rollback;
+		return ret;
 	}
 
 	/* M2M registration */
@@ -2327,9 +2317,6 @@ release_m2m:
 unreg_dev:
 	v4l2_device_unregister(&fdp1->v4l2_dev);
 
-vb2_allocator_rollback:
-	vb2_dma_contig_cleanup_ctx(fdp1->alloc_ctx);
-
 	return ret;
 }
 
@@ -2340,7 +2327,6 @@ static int fdp1_remove(struct platform_device *pdev)
 	v4l2_m2m_release(fdp1->m2m_dev);
 	video_unregister_device(&fdp1->vfd);
 	v4l2_device_unregister(&fdp1->v4l2_dev);
-	vb2_dma_contig_cleanup_ctx(fdp1->alloc_ctx);
 	pm_runtime_disable(&pdev->dev);
 
 	return 0;
-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2016-09-07 22:24 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07 22:25 [PATCH v3 00/10] v4l: platform: Add Renesas R-Car FDP1 Driver Laurent Pinchart
2016-09-07 22:25 ` Laurent Pinchart
2016-09-07 22:25 ` [PATCH v3 01/10] v4l: ioctl: Clear the v4l2_pix_format_mplane reserved field Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-08  7:04   ` Sakari Ailus
2016-09-07 22:25 ` [PATCH v3 02/10] v4l: ctrls: Add deinterlacing mode control Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-08  9:04   ` Kieran Bingham
2016-09-08  9:04     ` Kieran Bingham
2016-10-21 14:34   ` Hans Verkuil
2016-10-24  9:07     ` Laurent Pinchart
2016-09-07 22:25 ` [PATCH v3 03/10] v4l: Extend FCP compatible list to support the FDP Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-07 22:25 ` [PATCH v3 04/10] v4l: Add Renesas R-Car FDP1 Driver Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-07 22:25 ` Laurent Pinchart [this message]
2016-09-07 22:25   ` [PATCH v3 05/10] v4l: fdp1: vb2_queue dev conversion Laurent Pinchart
2016-09-08  9:05   ` Kieran Bingham
2016-09-08  9:05     ` Kieran Bingham
2016-09-07 22:25 ` [PATCH v3 06/10] v4l: fdp1: Incorporate miscellaneous review comments Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-11 16:35   ` Kieran Bingham
2016-09-11 16:35     ` Kieran Bingham
2016-09-07 22:25 ` [PATCH v3 07/10] v4l: fdp1: Remove unused struct fdp1_v4l2_buffer Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-09  7:29   ` Kieran Bingham
2016-09-09  7:29     ` Kieran Bingham
2016-09-07 22:25 ` [PATCH v3 08/10] v4l: fdp1: Rewrite format setting code Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-11 20:27   ` Kieran Bingham
2016-09-11 20:27     ` Kieran Bingham
2016-09-07 22:25 ` [PATCH v3 09/10] v4l: fdp1: Fix field validation when preparing buffer Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-11 16:45   ` Kieran Bingham
2016-09-11 16:45     ` Kieran Bingham
2016-09-07 22:25 ` [PATCH v3 10/10] v4l: fdp1: Store buffer information in vb2 buffer Laurent Pinchart
2016-09-07 22:25   ` Laurent Pinchart
2016-09-11 20:20   ` Kieran Bingham
2016-09-11 20:20     ` Kieran Bingham
2016-09-08  9:10 ` [PATCH v3 00/10] v4l: platform: Add Renesas R-Car FDP1 Driver Kieran Bingham
2016-09-08  9:10   ` Kieran Bingham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473287110-780-6-git-send-email-laurent.pinchart+renesas@ideasonboard.com \
    --to=laurent.pinchart+renesas@ideasonboard.com \
    --cc=kieran@ksquared.org.uk \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.