On to, 2016-11-17 at 12:08 +0000, Chris Wilson wrote:
> Some clients would like to iterate over every node within a certain
> range. Make a nice little macro for them to hide the mixing of the
> rbtree search and linear walk.
> 
> Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vet...@ffwll.ch>
> Cc: dri-de...@lists.freedesktop.org
> 

<SNIP>

> 
> @@ -174,19 +174,12 @@ INTERVAL_TREE_DEFINE(struct drm_mm_node, rb,
>                    START, LAST, static inline, drm_mm_interval_tree)
>  
>  struct drm_mm_node *
> -drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last)
> +__drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last)
>  {
>       return drm_mm_interval_tree_iter_first(&mm->interval_tree,
>                                              start, last);
>  }
> -EXPORT_SYMBOL(drm_mm_interval_first);
> -
> -struct drm_mm_node *
> -drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last)
> -{
> -     return drm_mm_interval_tree_iter_next(node, start, last);
> -}
> -EXPORT_SYMBOL(drm_mm_interval_next);

These were introduced by you so I guess the reason for them ceased to
exist, so the removal should not hurt anybody.

> +EXPORT_SYMBOL(__drm_mm_interval_first);
>  
>  static void drm_mm_interval_tree_add_node(struct drm_mm_node *hole_node,
>                                         struct drm_mm_node *node)
> diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
> index 41ddafe92b2f..fca5f313cf18 100644
> --- a/include/drm/drm_mm.h
> +++ b/include/drm/drm_mm.h
> @@ -308,10 +308,12 @@ void drm_mm_takedown(struct drm_mm *mm);
>  bool drm_mm_clean(struct drm_mm *mm);
>  
>  struct drm_mm_node *
> -drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last);
> +__drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last);
>  
> -struct drm_mm_node *
> -drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last);
> +#define drm_mm_for_each_node_in_range(node, mm, start, end)          \
> +     for (node = __drm_mm_interval_first((mm), (start), (end)-1);    \
> +          node && node->start < (end);                               \
> +          node = list_next_entry(node, node_list))                   \

Drop a quick kerneldoc for this. It's almost ready in the commit message.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to