Commit fa5034c667c224be48db31a0d043dba305e8e7a8

Authored by Clemens Ladisch
Committed by Mauro Carvalho Chehab
1 parent c1026c580d

[media] media: fix truncated entity specification

When enumerating an entity, assign the entire entity specification
instead of only the first two words. (This requires giving the
specification union a name.)

So far, no driver actually uses more than two words, but this will
be needed for ALSA entities.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
[laurent.pinchart@ideasonboard.com: Rename specification to info]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 4 changed files with 6 additions and 7 deletions Side-by-side Diff

drivers/media/media-device.c
... ... @@ -108,8 +108,7 @@
108 108 u_ent.group_id = ent->group_id;
109 109 u_ent.pads = ent->num_pads;
110 110 u_ent.links = ent->num_links - ent->num_backlinks;
111   - u_ent.v4l.major = ent->v4l.major;
112   - u_ent.v4l.minor = ent->v4l.minor;
  111 + memcpy(&u_ent.raw, &ent->info, sizeof(ent->info));
113 112 if (copy_to_user(uent, &u_ent, sizeof(u_ent)))
114 113 return -EFAULT;
115 114 return 0;
drivers/media/video/v4l2-dev.c
... ... @@ -701,8 +701,8 @@
701 701 vdev->vfl_type != VFL_TYPE_SUBDEV) {
702 702 vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
703 703 vdev->entity.name = vdev->name;
704   - vdev->entity.v4l.major = VIDEO_MAJOR;
705   - vdev->entity.v4l.minor = vdev->minor;
  704 + vdev->entity.info.v4l.major = VIDEO_MAJOR;
  705 + vdev->entity.info.v4l.minor = vdev->minor;
706 706 ret = media_device_register_entity(vdev->v4l2_dev->mdev,
707 707 &vdev->entity);
708 708 if (ret < 0)
drivers/media/video/v4l2-device.c
... ... @@ -234,8 +234,8 @@
234 234 goto clean_up;
235 235 }
236 236 #if defined(CONFIG_MEDIA_CONTROLLER)
237   - sd->entity.v4l.major = VIDEO_MAJOR;
238   - sd->entity.v4l.minor = vdev->minor;
  237 + sd->entity.info.v4l.major = VIDEO_MAJOR;
  238 + sd->entity.info.v4l.minor = vdev->minor;
239 239 #endif
240 240 sd->devnode = vdev;
241 241 }
include/media/media-entity.h
... ... @@ -98,7 +98,7 @@
98 98  
99 99 /* Sub-device specifications */
100 100 /* Nothing needed yet */
101   - };
  101 + } info;
102 102 };
103 103  
104 104 static inline u32 media_entity_type(struct media_entity *entity)