From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 11/24] drm: Introduce an iterator over holes in the drm_mm range manager Date: Wed, 12 Sep 2012 15:54:02 +0200 Message-ID: <20120912135402.GF5533@phenom.ffwll.local> References: <1346788996-19080-1-git-send-email-chris@chris-wilson.co.uk> <1346788996-19080-12-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ey0-f177.google.com (mail-ey0-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DF669E78E for ; Wed, 12 Sep 2012 06:53:30 -0700 (PDT) Received: by eaai12 with SMTP id i12so842893eaa.36 for ; Wed, 12 Sep 2012 06:53:29 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1346788996-19080-12-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: Dave Airlie , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Sep 04, 2012 at 09:03:03PM +0100, Chris Wilson wrote: > This will be used i915 in forthcoming patches in order to measure the > largest contiguous chunk of memory available for enabling chipset > features. > > Signed-off-by: Chris Wilson > Cc: Dave Airlie One nitpick below. > @@ -99,6 +112,19 @@ static inline bool drm_mm_initialized(struct drm_mm *mm) > entry != NULL; entry = next, \ > next = entry ? list_entry(entry->node_list.next, \ > struct drm_mm_node, node_list) : NULL) \ > + > +/* Note that we need to unroll list_for_each_entry in order to inline > + * setting hole_start and hole_end on each iteration and keep the > + * macro sane. > + */ > +#define drm_mm_for_each_hole(entry, mm, hole_start, hole_end) \ > + for (entry = list_entry((mm)->hole_stack.next, typeof(struct drm_mm_node), hole_stack); \ > + &entry->hole_stack != &(mm)->hole_stack ? \ > + hole_start = drm_mm_hole_node_start(entry), \ > + hole_end = drm_mm_hole_node_end(entry) : \ > + 0; \ > + entry = list_entry(entry->hole_stack.next, typeof(struct drm_mm_node), hole_stack)) Minor bikeshed for the macro: - typeof(struct drm_mm_node) is a bit redundant - I'd add a , 1 to the conditional check to not implicitly rely on drm_mm_hole_node_end != 0 for the correctness of this macro. With that this is: Reviewed-by: Daniel Vetter To follow due process can you please resubmit these two drm_mm patches to dri-devel, so that I can properly bugger Dave for his maintainer-ack? Thanks, Daniel > + > /* > * Basic range manager support (drm_mm.c) > */ > -- > 1.7.10.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch