Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254635
b: refs/heads/master
c: a96aa53
h: refs/heads/master
i:
  254633: d67d569
  254631: 32d79fb
v: v3
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Jul 1, 2011
1 parent eaaf938 commit 2492f9a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c064b8eac8da5d494fd221f14219c4f39502deb2
refs/heads/master: a96aa5342d575980e5b572cde88036f3a878ebee
34 changes: 21 additions & 13 deletions trunk/drivers/media/video/uvc/uvc_entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
struct uvc_entity *entity)
{
const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
struct uvc_entity *remote;
struct media_entity *sink;
unsigned int i;
u8 remote_pad;
int ret = 0;
int ret;

sink = (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
? (entity->vdev ? &entity->vdev->entity : NULL)
: &entity->subdev.entity;
if (sink == NULL)
return 0;

for (i = 0; i < entity->num_pads; ++i) {
struct media_entity *source;
struct media_entity *sink;
struct uvc_entity *remote;
u8 remote_pad;

if (!(entity->pads[i].flags & MEDIA_PAD_FL_SINK))
continue;
Expand All @@ -43,10 +49,11 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
if (remote == NULL)
return -EINVAL;

source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING)
? &remote->vdev->entity : &remote->subdev.entity;
sink = (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
? &entity->vdev->entity : &entity->subdev.entity;
source = (UVC_ENTITY_TYPE(remote) != UVC_TT_STREAMING)
? (remote->vdev ? &remote->vdev->entity : NULL)
: &remote->subdev.entity;
if (source == NULL)
continue;

remote_pad = remote->num_pads - 1;
ret = media_entity_create_link(source, remote_pad,
Expand All @@ -55,11 +62,10 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
return ret;
}

if (UVC_ENTITY_TYPE(entity) != UVC_TT_STREAMING)
ret = v4l2_device_register_subdev(&chain->dev->vdev,
&entity->subdev);
if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
return 0;

return ret;
return v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev);
}

static struct v4l2_subdev_ops uvc_subdev_ops = {
Expand All @@ -84,9 +90,11 @@ static int uvc_mc_init_entity(struct uvc_entity *entity)

ret = media_entity_init(&entity->subdev.entity,
entity->num_pads, entity->pads, 0);
} else
} else if (entity->vdev != NULL) {
ret = media_entity_init(&entity->vdev->entity,
entity->num_pads, entity->pads, 0);
} else
ret = 0;

return ret;
}
Expand Down

0 comments on commit 2492f9a

Please sign in to comment.