[media] v4l: vsp1: Extract pipeline initialization code into a function
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sun, 2 Aug 2015 20:32:13 +0000 (17:32 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 19 Feb 2016 11:07:07 +0000 (09:07 -0200)
The code will be reused outside of vsp1_video.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/vsp1/vsp1_pipe.c
drivers/media/platform/vsp1/vsp1_pipe.h
drivers/media/platform/vsp1/vsp1_video.c

index cdc670b88fcc1ec08fad113c839ad90c70eadca6..584a9d40814445963103067f3611cbad2dff99cd 100644 (file)
@@ -49,6 +49,16 @@ void vsp1_pipeline_reset(struct vsp1_pipeline *pipe)
        pipe->uds = NULL;
 }
 
+void vsp1_pipeline_init(struct vsp1_pipeline *pipe)
+{
+       mutex_init(&pipe->lock);
+       spin_lock_init(&pipe->irqlock);
+       init_waitqueue_head(&pipe->wq);
+
+       INIT_LIST_HEAD(&pipe->entities);
+       pipe->state = VSP1_PIPELINE_STOPPED;
+}
+
 void vsp1_pipeline_run(struct vsp1_pipeline *pipe)
 {
        struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
index f8a099fba973c6d8e06b7474c73fed9f60238a27..8553d5a03aa31d492760104ee869ece4da7ed18b 100644 (file)
@@ -67,6 +67,7 @@ static inline struct vsp1_pipeline *to_vsp1_pipeline(struct media_entity *e)
 }
 
 void vsp1_pipeline_reset(struct vsp1_pipeline *pipe);
+void vsp1_pipeline_init(struct vsp1_pipeline *pipe);
 
 void vsp1_pipeline_run(struct vsp1_pipeline *pipe);
 bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe);
index d616cbeb100aba0289ad30c1ce561d4ac587d5d0..3d5ea4a325ba10f0c6acda7e19b5990785adb32b 100644 (file)
@@ -1026,11 +1026,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device *vsp1,
        spin_lock_init(&video->irqlock);
        INIT_LIST_HEAD(&video->irqqueue);
 
-       mutex_init(&video->pipe.lock);
-       spin_lock_init(&video->pipe.irqlock);
-       INIT_LIST_HEAD(&video->pipe.entities);
-       init_waitqueue_head(&video->pipe.wq);
-       video->pipe.state = VSP1_PIPELINE_STOPPED;
+       vsp1_pipeline_init(&video->pipe);
        video->pipe.frame_end = vsp1_video_pipeline_frame_end;
 
        /* Initialize the media entity... */