Commit a93e5f4f authored by Todor Tomov's avatar Todor Tomov Committed by Mauro Carvalho Chehab

media: camss: vfe: Get line pointer as container of video_out

Simplify getting of the line pointer by using the container_of
macro instead of traversing media controller links.
Signed-off-by: default avatarTodor Tomov <todor.tomov@linaro.org>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent c9896b65
...@@ -2037,26 +2037,6 @@ static void vfe_put(struct vfe_device *vfe) ...@@ -2037,26 +2037,6 @@ static void vfe_put(struct vfe_device *vfe)
mutex_unlock(&vfe->power_lock); mutex_unlock(&vfe->power_lock);
} }
/*
* vfe_video_pad_to_line - Get pointer to VFE line by media pad
* @pad: Media pad
*
* Return pointer to vfe line structure
*/
static struct vfe_line *vfe_video_pad_to_line(struct media_pad *pad)
{
struct media_pad *vfe_pad;
struct v4l2_subdev *subdev;
vfe_pad = media_entity_remote_pad(pad);
if (vfe_pad == NULL)
return NULL;
subdev = media_entity_to_v4l2_subdev(vfe_pad->entity);
return container_of(subdev, struct vfe_line, subdev);
}
/* /*
* vfe_queue_buffer - Add empty buffer * vfe_queue_buffer - Add empty buffer
* @vid: Video device structure * @vid: Video device structure
...@@ -2070,16 +2050,11 @@ static struct vfe_line *vfe_video_pad_to_line(struct media_pad *pad) ...@@ -2070,16 +2050,11 @@ static struct vfe_line *vfe_video_pad_to_line(struct media_pad *pad)
static int vfe_queue_buffer(struct camss_video *vid, static int vfe_queue_buffer(struct camss_video *vid,
struct camss_buffer *buf) struct camss_buffer *buf)
{ {
struct vfe_device *vfe = &vid->camss->vfe; struct vfe_line *line = container_of(vid, struct vfe_line, video_out);
struct vfe_line *line; struct vfe_device *vfe = to_vfe(line);
struct vfe_output *output; struct vfe_output *output;
unsigned long flags; unsigned long flags;
line = vfe_video_pad_to_line(&vid->pad);
if (!line) {
dev_err(to_device(vfe), "Can not queue buffer\n");
return -1;
}
output = &line->output; output = &line->output;
spin_lock_irqsave(&vfe->output_lock, flags); spin_lock_irqsave(&vfe->output_lock, flags);
...@@ -2104,16 +2079,11 @@ static int vfe_queue_buffer(struct camss_video *vid, ...@@ -2104,16 +2079,11 @@ static int vfe_queue_buffer(struct camss_video *vid,
static int vfe_flush_buffers(struct camss_video *vid, static int vfe_flush_buffers(struct camss_video *vid,
enum vb2_buffer_state state) enum vb2_buffer_state state)
{ {
struct vfe_device *vfe = &vid->camss->vfe; struct vfe_line *line = container_of(vid, struct vfe_line, video_out);
struct vfe_line *line; struct vfe_device *vfe = to_vfe(line);
struct vfe_output *output; struct vfe_output *output;
unsigned long flags; unsigned long flags;
line = vfe_video_pad_to_line(&vid->pad);
if (!line) {
dev_err(to_device(vfe), "Can not flush buffers\n");
return -1;
}
output = &line->output; output = &line->output;
spin_lock_irqsave(&vfe->output_lock, flags); spin_lock_irqsave(&vfe->output_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment