From: Sakari Ailus <sakari.ailus@iki.fi>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [media-ctl PATCH 1/1] libmediactl: Implement MEDIA_ENT_ID_FLAG_NEXT in media_get_entity_by_id()
Date: Sun, 15 Jan 2012 17:40:56 +0200 [thread overview]
Message-ID: <4F12F388.3000508@iki.fi> (raw)
In-Reply-To: <201201151444.08443.laurent.pinchart@ideasonboard.com>
Hi Laurent,
Laurent Pinchart wrote:
> On Saturday 14 January 2012 20:33:36 Sakari Ailus wrote:
>> Signed-off-by: Sakari Ailus<sakari.ailus@iki.fi>
>> ---
>> src/mediactl.c | 9 +++++++--
>> src/mediactl.h | 4 +++-
>> 2 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mediactl.c b/src/mediactl.c
>> index 5b8c587..f62fcdf 100644
>> --- a/src/mediactl.c
>> +++ b/src/mediactl.c
>> @@ -81,8 +81,13 @@ struct media_entity *media_get_entity_by_id(struct
>> media_device *media, for (i = 0; i< media->entities_count; ++i) {
>> struct media_entity *entity =&media->entities[i];
>>
>> - if (entity->info.id == id)
>> - return entity;
>> + if (!(id& MEDIA_ENT_ID_FLAG_NEXT)) {
>> + if (entity->info.id == id)
>> + return entity;
>> + } else {
>> + if (entity->info.id>= (id& ~MEDIA_ENT_ID_FLAG_NEXT)
>> + return entity;
>> + }
>
> Just one question that hasn't crossed my mind before, why do you need this ?
> If you want to enumerate entities in an application you can just iterate over
> media_device::entities.
We do have the MEDIA_ENT_ID_FLAG_NEXT flag which is intended to help in
entity enumeration. Currently the range of entity ids is contiguous in
all practical implementation but will that always be the case, also in
the future? A few things might break in the kernel if the range is
non-contiguous as well, but that's still internal to the kernel.
However, this is a user space library and if this interface change is
not made, we essentially are making a promise that the entity ranges
will always be contiguous.
I wouldn't as there's no need to do so.
I you think about programmable hardware, entities there are logical
rather than physical and their existence may be dependent on multiple
factors.
--
Sakari Ailus
sakari.ailus@iki.fi
next prev parent reply other threads:[~2012-01-15 15:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-14 19:33 [media-ctl PATCH 1/1] libmediactl: Implement MEDIA_ENT_ID_FLAG_NEXT in media_get_entity_by_id() Sakari Ailus
2012-01-15 13:44 ` Laurent Pinchart
2012-01-15 15:40 ` Sakari Ailus [this message]
2012-01-15 17:31 ` Laurent Pinchart
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=4F12F388.3000508@iki.fi \
--to=sakari.ailus@iki.fi \
--cc=laurent.pinchart@ideasonboard.com \
--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