Re: [RFC PATCH] drm/i915: fix potential dangling else problems in for_each_ macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 25 Nov 2015, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
> On Tue, Nov 24, 2015 at 10:26:01PM +0000, Chris Wilson wrote:
>> On Tue, Nov 24, 2015 at 07:36:25PM +0200, Jani Nikula wrote:
>> >  /* Iterate over initialised rings */
>> >  #define for_each_ring(ring__, dev_priv__, i__) \
>> >  	for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \
>> > -		if (((ring__) = &(dev_priv__)->ring[(i__)]), intel_ring_initialized((ring__)))
>> > +		for_each_if ((((ring__) = &(dev_priv__)->ring[(i__)]), intel_ring_initialized((ring__))))
>> 
>> Idly wondering if we would be happy with
>> 
>> for_each_ring(ring__, dev_priv__)
>> 	for ((ring__) = &(dev_priv__)->ring[0];
>> 	     (ring__) <= &(dev_priv__)->ring[I915_NUM_RINGS];
>> 	     (ring__)++)
>> 	     for_each_if(intel_ring_initialized(ring__))
>> 
>> ?
>> 
>> The downside is that we have used i__ in several places rather than
>> ring->id.
>
> Fwiw, 13 files changed, 113 insertions(+), 140 deletions(-)

Seems good, looks like you have the patch so I won't bother. v2 of my
patch was merged to drm-misc now, so that complicates a bit. Perhaps the
i__ to ring->id change could be a prep step. *shrug*.

BR,
Jani.



>
> Seems a reasonable shrinkage.
> -Chris

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux