mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 17:43:59 +00:00
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: Todor Tomov <todor.tomov@linaro.org> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
c9896b6551
commit
a93e5f4fc8
@ -2037,26 +2037,6 @@ exit:
|
|||||||
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)
|
|||||||
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,
|
|||||||
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user