Hi Sakari,

Thanks for the patch.

On Saturday 14 January 2012 20:33:36 Sakari Ailus wrote:
> Signed-off-by: Sakari Ailus <sakari.ai...@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.

>       }
> 
>       return NULL;
> diff --git a/src/mediactl.h b/src/mediactl.h
> index 1b47b7e..4d3892e 100644
> --- a/src/mediactl.h
> +++ b/src/mediactl.h
> @@ -164,7 +164,9 @@ struct media_entity *media_get_entity_by_name(struct
> media_device *media, * @param media - media device.
>   * @param id - entity ID.
>   *
> - * Search for an entity with an ID equal to @a id.
> + * Search for an entity with an ID equal to @a id. If id flag
> + * MEDIA_ENT_ID_FLAG_NEXT is present, an entity with ID greater or equal
> to + * @a id will be returned.
>   *
>   * @return A pointer to the entity if found, or NULL otherwise.
>   */

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to