On Mon, Jul 01, 2013 at 08:32:59PM +0200, David Herrmann wrote: > This helper tests whether a given node is currently linked into a drm_mm > manager. We use the node->mm pointer for that as it is set for all linked > objects. > > We also reset node->mm whenever a node is removed. All such access is > currently safe as everyone calls kfree() on the object directly after > removing it. Furthermore, no-one is supposed to access node->mm from > outside drm_mm.c, anyway. > > Signed-off-by: David Herrmann <dh.herrmann@xxxxxxxxx> > --- > drivers/gpu/drm/drm_mm.c | 1 + > include/drm/drm_mm.h | 5 +++++ > 2 files changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c > index 7917729..3bd43ce 100644 > --- a/drivers/gpu/drm/drm_mm.c > +++ b/drivers/gpu/drm/drm_mm.c > @@ -374,6 +374,7 @@ void drm_mm_remove_node(struct drm_mm_node *node) > > list_del(&node->node_list); > node->allocated = 0; > + node->mm = NULL; > } > EXPORT_SYMBOL(drm_mm_remove_node); > > diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h > index de92425..d83b966 100644 > --- a/include/drm/drm_mm.h > +++ b/include/drm/drm_mm.h > @@ -85,6 +85,11 @@ static inline bool drm_mm_node_allocated(struct drm_mm_node *node) > return node->allocated; > } > > +static inline bool drm_mm_node_linked(struct drm_mm_node *node) > +{ > + return node->mm; > +} I've only checked a few examples, but this seems to duplicate what the drm_mm_node_allocated right above was meant for. Or do I miss something here? -Daniel > + > static inline bool drm_mm_initialized(struct drm_mm *mm) > { > return mm->hole_stack.next; > -- > 1.8.3.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel