Message ID | 20200610230541.1603067-2-niklas.soderlund+renesas@ragnatech.se (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media-device: Report if graph is complete | expand |
Hi Niklas, Thank you for the patch. On Thu, Jun 11, 2020 at 01:05:37AM +0200, Niklas Söderlund wrote: > Add a flags field to the media_v2_topology structure by taking one > of the reserved u32 fields. Also define a flag to carry information > about if the graph is complete. The use-case is to have a way to report > to user-space if the media graph contains all subdevices. > > The other bits in the flags field are unused for now, but could be > claimed to carry other type of information in the future. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > --- > drivers/media/mc/mc-device.c | 2 +- > include/uapi/linux/media.h | 4 +++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c > index da8088351135298a..c2ef5bb512a5fba0 100644 > --- a/drivers/media/mc/mc-device.c > +++ b/drivers/media/mc/mc-device.c > @@ -242,6 +242,7 @@ static long media_device_get_topology(struct media_device *mdev, void *arg) > int ret = 0; > > topo->topology_version = mdev->topology_version; > + topo->flags = 0; > > /* Get entities and number of entities */ > i = 0; > @@ -269,7 +270,6 @@ static long media_device_get_topology(struct media_device *mdev, void *arg) > uentity++; > } > topo->num_entities = i; > - topo->reserved1 = 0; > > /* Get interfaces and number of interfaces */ > i = 0; > diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h > index 383ac7b7d8f07eca..7c07b9939252c768 100644 > --- a/include/uapi/linux/media.h > +++ b/include/uapi/linux/media.h > @@ -351,7 +351,7 @@ struct media_v2_topology { > __u64 topology_version; > > __u32 num_entities; > - __u32 reserved1; > + __u32 flags; > __u64 ptr_entities; > > __u32 num_interfaces; > @@ -367,6 +367,8 @@ struct media_v2_topology { > __u64 ptr_links; > } __attribute__ ((packed)); > > +#define MEDIA_TOPOLOGY_FLAG_COMPLETE (1 << 0) > + Missing documentation :-) Should we use the BIT() macro ? > /* ioctls */ > > #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
On Thu, Jun 11, 2020 at 06:12:26AM +0300, Laurent Pinchart wrote: > > diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h > > index 383ac7b7d8f07eca..7c07b9939252c768 100644 > > --- a/include/uapi/linux/media.h > > +++ b/include/uapi/linux/media.h > > @@ -351,7 +351,7 @@ struct media_v2_topology { > > __u64 topology_version; > > > > __u32 num_entities; > > - __u32 reserved1; > > + __u32 flags; > > __u64 ptr_entities; > > > > __u32 num_interfaces; > > @@ -367,6 +367,8 @@ struct media_v2_topology { > > __u64 ptr_links; > > } __attribute__ ((packed)); > > > > +#define MEDIA_TOPOLOGY_FLAG_COMPLETE (1 << 0) > > + > > Missing documentation :-) > > Should we use the BIT() macro ? No, it's uAPI.
diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c index da8088351135298a..c2ef5bb512a5fba0 100644 --- a/drivers/media/mc/mc-device.c +++ b/drivers/media/mc/mc-device.c @@ -242,6 +242,7 @@ static long media_device_get_topology(struct media_device *mdev, void *arg) int ret = 0; topo->topology_version = mdev->topology_version; + topo->flags = 0; /* Get entities and number of entities */ i = 0; @@ -269,7 +270,6 @@ static long media_device_get_topology(struct media_device *mdev, void *arg) uentity++; } topo->num_entities = i; - topo->reserved1 = 0; /* Get interfaces and number of interfaces */ i = 0; diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 383ac7b7d8f07eca..7c07b9939252c768 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -351,7 +351,7 @@ struct media_v2_topology { __u64 topology_version; __u32 num_entities; - __u32 reserved1; + __u32 flags; __u64 ptr_entities; __u32 num_interfaces; @@ -367,6 +367,8 @@ struct media_v2_topology { __u64 ptr_links; } __attribute__ ((packed)); +#define MEDIA_TOPOLOGY_FLAG_COMPLETE (1 << 0) + /* ioctls */ #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
Add a flags field to the media_v2_topology structure by taking one of the reserved u32 fields. Also define a flag to carry information about if the graph is complete. The use-case is to have a way to report to user-space if the media graph contains all subdevices. The other bits in the flags field are unused for now, but could be claimed to carry other type of information in the future. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> --- drivers/media/mc/mc-device.c | 2 +- include/uapi/linux/media.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)