@@ -43,7 +43,7 @@
*/
#include <linux/export.h>
-#include <linux/interval_tree_generic.h>
+#include <linux/interval_tree_gen.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/stacktrace.h>
@@ -150,11 +150,11 @@ static void show_leaks(struct drm_mm *mm) { }
#endif
#define START(node) ((node)->start)
-#define LAST(node) ((node)->start + (node)->size - 1)
+#define END(node) ((node)->start + (node)->size)
INTERVAL_TREE_DEFINE(struct drm_mm_node, rb,
u64, __subtree_last,
- START, LAST, static inline, drm_mm_interval_tree)
+ START, END, static inline, drm_mm_interval_tree)
struct drm_mm_node *
__drm_mm_interval_first(const struct drm_mm *mm, u64 start, u64 last)
@@ -172,7 +172,7 @@ static void drm_mm_interval_tree_add_node(struct drm_mm_node *hole_node,
struct drm_mm_node *parent;
bool leftmost;
- node->__subtree_last = LAST(node);
+ node->__subtree_last = END(node);
if (hole_node->allocated) {
rb = &hole_node->rb;
@@ -1150,7 +1150,7 @@ static int check_scratch(struct i915_gem_context *ctx, u64 offset)
{
struct drm_mm_node *node =
__drm_mm_interval_first(&ctx->vm->mm,
- offset, offset + sizeof(u32) - 1);
+ offset, offset + sizeof(u32));
if (!node || node->start > offset)
return 0;
@@ -853,7 +853,7 @@ static bool assert_contiguous_in_range(struct drm_mm *mm,
}
if (start > 0) {
- node = __drm_mm_interval_first(mm, 0, start - 1);
+ node = __drm_mm_interval_first(mm, 0, start);
if (node->allocated) {
pr_err("node before start: node=%llx+%llu, start=%llx\n",
node->start, node->size, start);
@@ -485,19 +485,19 @@ __drm_mm_interval_first(const struct drm_mm *mm, u64 start, u64 last);
* @node__: drm_mm_node structure to assign to in each iteration step
* @mm__: drm_mm allocator to walk
* @start__: starting offset, the first node will overlap this
- * @end__: ending offset, the last node will start before this (but may overlap)
+ * @end__: ending offset, the last node will start before this
*
* This iterator walks over all nodes in the range allocator that lie
* between @start and @end. It is implemented similarly to list_for_each(),
* but using the internal interval tree to accelerate the search for the
* starting node, and so not safe against removal of elements. It assumes
* that @end is within (or is the upper limit of) the drm_mm allocator.
- * If [@start, @end] are beyond the range of the drm_mm, the iterator may walk
+ * If [@start, @end) are beyond the range of the drm_mm, the iterator may walk
* over the special _unallocated_ &drm_mm.head_node, and may even continue
* indefinitely.
*/
#define drm_mm_for_each_node_in_range(node__, mm__, start__, end__) \
- for (node__ = __drm_mm_interval_first((mm__), (start__), (end__)-1); \
+ for (node__ = __drm_mm_interval_first((mm__), (start__), (end__)); \
node__->start < (end__); \
node__ = list_next_entry(node__, node_list))
The drm_mm interval tree really wants [a, b) intervals, not fully closed as it is now. As such convert it to use the new interval_tree_gen.h. Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Davidlohr Bueso <dbueso@suse.de> --- drivers/gpu/drm/drm_mm.c | 8 ++++---- drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c | 2 +- drivers/gpu/drm/selftests/test-drm_mm.c | 2 +- include/drm/drm_mm.h | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-)