media: ti-vpe: cal: Avoid function forward declaration
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 6 Jul 2020 18:35:23 +0000 (20:35 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 19 Jul 2020 06:28:18 +0000 (08:28 +0200)
Move the cal_complete_ctx() function earlier in the file to avoid a
foward declaration. There is no functional change.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/ti-vpe/cal.c

index 1942524..88fed93 100644 (file)
@@ -1852,7 +1852,61 @@ static const struct video_device cal_videodev = {
  *     Initialization and module stuff
  * ------------------------------------------------------------------
  */
-static int cal_complete_ctx(struct cal_ctx *ctx);
+
+static int cal_complete_ctx(struct cal_ctx *ctx)
+{
+       struct video_device *vfd;
+       struct vb2_queue *q;
+       int ret;
+
+       ctx->timeperframe = tpf_default;
+       ctx->external_rate = 192000000;
+
+       /* initialize locks */
+       spin_lock_init(&ctx->slock);
+       mutex_init(&ctx->mutex);
+
+       /* initialize queue */
+       q = &ctx->vb_vidq;
+       q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+       q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ;
+       q->drv_priv = ctx;
+       q->buf_struct_size = sizeof(struct cal_buffer);
+       q->ops = &cal_video_qops;
+       q->mem_ops = &vb2_dma_contig_memops;
+       q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+       q->lock = &ctx->mutex;
+       q->min_buffers_needed = 3;
+       q->dev = ctx->v4l2_dev.dev;
+
+       ret = vb2_queue_init(q);
+       if (ret)
+               return ret;
+
+       /* init video dma queues */
+       INIT_LIST_HEAD(&ctx->vidq.active);
+
+       vfd = &ctx->vdev;
+       *vfd = cal_videodev;
+       vfd->v4l2_dev = &ctx->v4l2_dev;
+       vfd->queue = q;
+
+       /*
+        * Provide a mutex to v4l2 core. It will be used to protect
+        * all fops and v4l2 ioctls.
+        */
+       vfd->lock = &ctx->mutex;
+       video_set_drvdata(vfd, ctx);
+
+       ret = video_register_device(vfd, VFL_TYPE_VIDEO, video_nr);
+       if (ret < 0)
+               return ret;
+
+       v4l2_info(&ctx->v4l2_dev, "V4L2 device registered as %s\n",
+                 video_device_node_name(vfd));
+
+       return 0;
+}
 
 static int cal_async_bound(struct v4l2_async_notifier *notifier,
                           struct v4l2_subdev *subdev,
@@ -1948,61 +2002,6 @@ static const struct v4l2_async_notifier_operations cal_async_ops = {
        .complete = cal_async_complete,
 };
 
-static int cal_complete_ctx(struct cal_ctx *ctx)
-{
-       struct video_device *vfd;
-       struct vb2_queue *q;
-       int ret;
-
-       ctx->timeperframe = tpf_default;
-       ctx->external_rate = 192000000;
-
-       /* initialize locks */
-       spin_lock_init(&ctx->slock);
-       mutex_init(&ctx->mutex);
-
-       /* initialize queue */
-       q = &ctx->vb_vidq;
-       q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-       q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ;
-       q->drv_priv = ctx;
-       q->buf_struct_size = sizeof(struct cal_buffer);
-       q->ops = &cal_video_qops;
-       q->mem_ops = &vb2_dma_contig_memops;
-       q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
-       q->lock = &ctx->mutex;
-       q->min_buffers_needed = 3;
-       q->dev = ctx->v4l2_dev.dev;
-
-       ret = vb2_queue_init(q);
-       if (ret)
-               return ret;
-
-       /* init video dma queues */
-       INIT_LIST_HEAD(&ctx->vidq.active);
-
-       vfd = &ctx->vdev;
-       *vfd = cal_videodev;
-       vfd->v4l2_dev = &ctx->v4l2_dev;
-       vfd->queue = q;
-
-       /*
-        * Provide a mutex to v4l2 core. It will be used to protect
-        * all fops and v4l2 ioctls.
-        */
-       vfd->lock = &ctx->mutex;
-       video_set_drvdata(vfd, ctx);
-
-       ret = video_register_device(vfd, VFL_TYPE_VIDEO, video_nr);
-       if (ret < 0)
-               return ret;
-
-       v4l2_info(&ctx->v4l2_dev, "V4L2 device registered as %s\n",
-                 video_device_node_name(vfd));
-
-       return 0;
-}
-
 static struct device_node *
 of_get_next_port(const struct device_node *parent,
                 struct device_node *prev)