[Intel-gfx] [PATCH v2 1/3] drm/i915: Use i915_vm_to_ppgtt instead of manual container_of

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Fri Apr 1 07:15:44 UTC 2016


On pe, 2016-04-01 at 08:12 +0100, Chris Wilson wrote:
> On Fri, Apr 01, 2016 at 10:05:03AM +0300, Joonas Lahtinen wrote:
> > 
> > Looks much better without container_of everywhere.
> > 
> > v2:
> > 
> > - In i915_gem_restore_gtt_mappings too (Chris)
> > @@ -3294,9 +3282,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
> >  		list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
> >  			/* TODO: Perhaps it shouldn't be gen6 specific */
> >  
> > -			struct i915_hw_ppgtt *ppgtt =
> > -					container_of(vm, struct i915_hw_ppgtt,
> > -						     base);
> > +			struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
> >  
> >  			if (i915_is_ggtt(vm))
> >  				ppgtt = dev_priv->mm.aliasing_ppgtt;
> Sadly, WARN.
> 

Oops.

> struct i915_hw_ppgtt *ppgtt;
> 
> if (i915_is_ggtt(vm))
> 	ppgtt = dev_priv->mm.aliasing_ppgtt;
> else
> 	ppgtt = i915_vm_to_ppgtt(vm);
> -Chris
> 
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list