media: add 'index' to struct media_v2_pad
The v2 pad structure never exposed the pad index, which made it impossible to call the MEDIA_IOC_SETUP_LINK ioctl, which needs that information. It is really trivial to just expose this information, so implement this. Signed-off-by: Hans Verkuil <hansverk@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
76e464888b
commit
30b914c8d8
@@ -331,6 +331,7 @@ static long media_device_get_topology(struct media_device *mdev, void *arg)
|
|||||||
kpad.id = pad->graph_obj.id;
|
kpad.id = pad->graph_obj.id;
|
||||||
kpad.entity_id = pad->entity->graph_obj.id;
|
kpad.entity_id = pad->entity->graph_obj.id;
|
||||||
kpad.flags = pad->flags;
|
kpad.flags = pad->flags;
|
||||||
|
kpad.index = pad->index;
|
||||||
|
|
||||||
if (copy_to_user(upad, &kpad, sizeof(kpad)))
|
if (copy_to_user(upad, &kpad, sizeof(kpad)))
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
|
@@ -305,11 +305,21 @@ struct media_v2_interface {
|
|||||||
};
|
};
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Appeared in 4.19.0.
|
||||||
|
*
|
||||||
|
* The media_version argument comes from the media_version field in
|
||||||
|
* struct media_device_info.
|
||||||
|
*/
|
||||||
|
#define MEDIA_V2_PAD_HAS_INDEX(media_version) \
|
||||||
|
((media_version) >= ((4 << 16) | (19 << 8) | 0))
|
||||||
|
|
||||||
struct media_v2_pad {
|
struct media_v2_pad {
|
||||||
__u32 id;
|
__u32 id;
|
||||||
__u32 entity_id;
|
__u32 entity_id;
|
||||||
__u32 flags;
|
__u32 flags;
|
||||||
__u32 reserved[5];
|
__u32 index;
|
||||||
|
__u32 reserved[4];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct media_v2_link {
|
struct media_v2_link {
|
||||||
|
Reference in New Issue
Block a user