From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hansverk@cisco.com>
Subject: Re: [PATCHv2 4/9] media: add function field to struct media_entity_desc
Date: Mon, 16 Apr 2018 15:01:12 -0300 [thread overview]
Message-ID: <20180416150112.5e813d33@vento.lan> (raw)
In-Reply-To: <20180416132121.46205-5-hverkuil@xs4all.nl>
Em Mon, 16 Apr 2018 15:21:16 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:
> From: Hans Verkuil <hansverk@cisco.com>
>
> This adds support for 'proper' functions to the existing API.
> This information was before only available through the new v2
> API, with this change it's available to both.
>
> Yes, the plan is to allow entities to expose multiple functions for
> multi-function devices, but we do not support it anywhere so this
> is still vaporware.
I'm not convinced about that. I would, instead, just keep it as-is
and be sure that applications stop use the legacy calls.
>
> Signed-off-by: Hans Verkuil <hansverk@cisco.com>
> ---
> drivers/media/media-device.c | 1 +
> include/uapi/linux/media.h | 7 ++++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 7c3ab37c258a..dca1e5a3e0f9 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -115,6 +115,7 @@ static long media_device_enum_entities(struct media_device *mdev,
> if (ent->name)
> strlcpy(entd->name, ent->name, sizeof(entd->name));
> entd->type = ent->function;
> + entd->function = ent->function;
> entd->revision = 0; /* Unused */
I got confused here, until I went to the code and noticed that
entd->type is actually touched after this.
If we're willing to do that, you should add a comment there explaining
why we need to pass both type and function to userspace.
> entd->flags = ent->flags;
> entd->group_id = 0; /* Unused */
> diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> index 86c7dcc9cba3..ac08acffdb65 100644
> --- a/include/uapi/linux/media.h
> +++ b/include/uapi/linux/media.h
> @@ -146,6 +146,10 @@ struct media_device_info {
> /* OR with the entity id value to find the next entity */
> #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
>
> +/* Appeared in 4.18.0 */
> +#define MEDIA_ENTITY_DESC_HAS_FUNCTION(media_version) \
> + ((media_version) >= 0x00041200)
> +
> struct media_entity_desc {
> __u32 id;
> char name[32];
> @@ -155,8 +159,9 @@ struct media_entity_desc {
> __u32 group_id;
> __u16 pads;
> __u16 links;
> + __u32 function;
>
> - __u32 reserved[4];
> + __u32 reserved[3];
>
> union {
> /* Node specifications */
Thanks,
Mauro
next prev parent reply other threads:[~2018-04-16 18:01 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 13:21 [PATCHv2 0/9] media/mc: fix inconsistencies Hans Verkuil
2018-04-16 13:21 ` [PATCHv2 1/9] v4l2-mediabus.h: add hsv_enc Hans Verkuil
2018-04-16 18:12 ` Mauro Carvalho Chehab
2018-04-16 13:21 ` [PATCHv2 2/9] subdev-formats.rst: fix incorrect types Hans Verkuil
2018-04-16 13:21 ` [PATCHv2 3/9] media.h: remove __NEED_MEDIA_LEGACY_API Hans Verkuil
2018-04-16 17:56 ` Mauro Carvalho Chehab
2018-04-16 13:21 ` [PATCHv2 4/9] media: add function field to struct media_entity_desc Hans Verkuil
2018-04-16 18:01 ` Mauro Carvalho Chehab [this message]
2018-04-16 19:27 ` Hans Verkuil
2018-04-16 19:40 ` Mauro Carvalho Chehab
2018-04-16 19:48 ` Hans Verkuil
2018-04-17 12:02 ` Mauro Carvalho Chehab
2018-04-16 13:21 ` [PATCHv2 5/9] media-ioc-enum-entities.rst: document new 'function' field Hans Verkuil
2018-04-16 18:02 ` Mauro Carvalho Chehab
2018-04-16 13:21 ` [PATCHv2 6/9] media: add 'index' to struct media_v2_pad Hans Verkuil
2018-04-16 18:03 ` Mauro Carvalho Chehab
2018-04-16 18:09 ` Mauro Carvalho Chehab
2018-04-16 19:41 ` Hans Verkuil
2018-04-17 9:59 ` Hans Verkuil
2018-04-17 11:55 ` Mauro Carvalho Chehab
2018-04-17 12:01 ` Hans Verkuil
2018-04-17 12:16 ` Mauro Carvalho Chehab
2018-04-17 12:19 ` Hans Verkuil
2018-06-15 13:14 ` Hans Verkuil
2018-04-16 13:21 ` [PATCHv2 7/9] media-ioc-g-topology.rst: document new 'index' field Hans Verkuil
2018-04-16 18:04 ` Mauro Carvalho Chehab
2018-04-16 13:21 ` [PATCHv2 8/9] media: add flags field to struct media_v2_entity Hans Verkuil
2018-04-16 13:21 ` [PATCHv2 9/9] media-ioc-g-topology.rst: document new 'flags' field Hans Verkuil
2018-04-16 18:10 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180416150112.5e813d33@vento.lan \
--to=mchehab@s-opensource.com \
--cc=hansverk@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).