[media] media: fix truncated entity specification
authorClemens Ladisch <clemens@ladisch.de>
Sat, 5 Nov 2011 21:42:01 +0000 (18:42 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 20 Dec 2011 11:31:50 +0000 (09:31 -0200)
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>
drivers/media/media-device.c
drivers/media/video/v4l2-dev.c
drivers/media/video/v4l2-device.c
include/media/media-entity.h

index 6edc9ba81203698e9948c066ddfac2370a142b1d..6f9eb94e85b387f78f144fd74c244e0e0859237a 100644 (file)
@@ -108,8 +108,7 @@ static long media_device_enum_entities(struct media_device *mdev,
        u_ent.group_id = ent->group_id;
        u_ent.pads = ent->num_pads;
        u_ent.links = ent->num_links - ent->num_backlinks;
-       u_ent.v4l.major = ent->v4l.major;
-       u_ent.v4l.minor = ent->v4l.minor;
+       memcpy(&u_ent.raw, &ent->info, sizeof(ent->info));
        if (copy_to_user(uent, &u_ent, sizeof(u_ent)))
                return -EFAULT;
        return 0;
index 6a07d283456bec1055e301cc4e780de9a94d8c1a..96e9615663e9d912b8868719b7c53d5ca73cfae6 100644 (file)
@@ -701,8 +701,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
            vdev->vfl_type != VFL_TYPE_SUBDEV) {
                vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
                vdev->entity.name = vdev->name;
-               vdev->entity.v4l.major = VIDEO_MAJOR;
-               vdev->entity.v4l.minor = vdev->minor;
+               vdev->entity.info.v4l.major = VIDEO_MAJOR;
+               vdev->entity.info.v4l.minor = vdev->minor;
                ret = media_device_register_entity(vdev->v4l2_dev->mdev,
                        &vdev->entity);
                if (ret < 0)
index 0edd618b9ddf17c1a117b157428df48ceccca1ae..1f203b85a63739463a448259800b31f240359bbf 100644 (file)
@@ -234,8 +234,8 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev)
                        goto clean_up;
                }
 #if defined(CONFIG_MEDIA_CONTROLLER)
-               sd->entity.v4l.major = VIDEO_MAJOR;
-               sd->entity.v4l.minor = vdev->minor;
+               sd->entity.info.v4l.major = VIDEO_MAJOR;
+               sd->entity.info.v4l.minor = vdev->minor;
 #endif
                sd->devnode = vdev;
        }
index cd8bca63a502975340839b9c54174bc44ba17f97..29e7bba78ffeb540f597e25ac3b221ed88001267 100644 (file)
@@ -98,7 +98,7 @@ struct media_entity {
 
                /* Sub-device specifications */
                /* Nothing needed yet */
-       };
+       } info;
 };
 
 static inline u32 media_entity_type(struct media_entity *entity)